diff --git a/app/package.json b/app/package.json index 6388325cc0..2172118cb4 100755 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "tidepool-uploader", "productName": "tidepool-uploader", - "version": "2.2.5-600series-qa.21", + "version": "2.2.5-600series-qa.22", "description": "Tidepool Project Universal Uploader", "main": "./main.js", "author": { diff --git a/lib/drivers/medtronic600/medtronic600Simulator.js b/lib/drivers/medtronic600/medtronic600Simulator.js index 5267806e02..aba3e63ac8 100644 --- a/lib/drivers/medtronic600/medtronic600Simulator.js +++ b/lib/drivers/medtronic600/medtronic600Simulator.js @@ -282,12 +282,15 @@ class Medtronic600Simulator { smbg(event) { if (this.currSMBG != null && this.currSMBG.value === event.value) { - debug( - 'Duplicate SMBG value (', event.value, ')', this.currSMBG.subType, this.currSMBG.time, - '/', event.subType, event.time, - ); + debug(`Duplicate SMBG value (${event.value}) ${this.currSMBG.subType}: ${this.currSMBG.time} / ${event.subType}: ${event.time}`); const duration = Date.parse(event.time) - Date.parse(this.currSMBG.time); - if ((duration < (15 * sundial.MIN_TO_MSEC)) && (event.subType === 'manual') && + if (_.isEqual(event, this.currSMBG)) { + // The BloodGlucoseReadingEvent event can be sent twice, if the second event + // is a calibration. Since we build calibrations from CalibrationCompleteEvent, + // we can delete the exact duplicate. + debug('Dropping exact duplicate'); + return; + } else if ((duration < (15 * sundial.MIN_TO_MSEC)) && (event.subType === 'manual') && (this.currSMBG.subType === 'linked')) { debug('Dropping duplicate manual value'); return; diff --git a/package.json b/package.json index d9c596b784..b27d831dab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tidepool-uploader", - "version": "2.2.5-600series-qa.21", + "version": "2.2.5-600series-qa.22", "description": "Tidepool Project Universal Uploader", "private": true, "main": "main.js", diff --git a/test/node/medtronic600/testMedtronic600Simulator.js b/test/node/medtronic600/testMedtronic600Simulator.js index 78a94a6a33..a665613f72 100644 --- a/test/node/medtronic600/testMedtronic600Simulator.js +++ b/test/node/medtronic600/testMedtronic600Simulator.js @@ -107,13 +107,11 @@ describe('medtronic600Simulator.js', function() { expect(simulator.getEvents()).deep.equals([linked]); }); - it('should not drop duplicate linked values', function() { + it('should drop exact duplicate linked values', function() { simulator.smbg(linked); simulator.smbg(linked); - const expectedSecond = _.cloneDeep(linked); - - expect(simulator.getEvents()).deep.equals([linked, expectedSecond]); + expect(simulator.getEvents()).deep.equals([linked]); }); });