From 8f1345ec15e11ad64e0b4c2b2af2f010a263175f Mon Sep 17 00:00:00 2001 From: Gerrit Niezen Date: Wed, 15 Jul 2020 13:48:59 +0100 Subject: [PATCH 1/3] check if postalarm is null *before* switch statement --- lib/drivers/insulet/insuletDriver.js | 210 +++++++++++++-------------- 1 file changed, 105 insertions(+), 105 deletions(-) diff --git a/lib/drivers/insulet/insuletDriver.js b/lib/drivers/insulet/insuletDriver.js index 8d76477433..cf047331f2 100644 --- a/lib/drivers/insulet/insuletDriver.js +++ b/lib/drivers/insulet/insuletDriver.js @@ -1000,113 +1000,113 @@ module.exports = (config) => { postalarm = null; } const alarmText = getNameForValue(ALARM_TYPES, alarmValue); - switch (alarmValue) { - // alarmType `other` - // History - ALARM - case ALARM_TYPES.AlrmADV_KEY.value: - case ALARM_TYPES.AlrmEXP_WARNING.value: - case ALARM_TYPES.AlrmSYSTEM_ERROR10.value: - case ALARM_TYPES.AlrmSYSTEM_ERROR12.value: - case ALARM_TYPES.AlrmSYSTEM_ERROR28.value: - case ALARM_TYPES.AlrmPDM_ERROR0.value: - case ALARM_TYPES.AlrmPDM_ERROR1.value: - case ALARM_TYPES.AlrmPDM_ERROR2.value: - case ALARM_TYPES.AlrmPDM_ERROR3.value: - case ALARM_TYPES.AlrmPDM_ERROR4.value: - case ALARM_TYPES.AlrmPDM_ERROR5.value: - case ALARM_TYPES.AlrmPDM_ERROR6.value: - case ALARM_TYPES.AlrmPDM_ERROR7.value: - case ALARM_TYPES.AlrmPDM_ERROR8.value: - case ALARM_TYPES.AlrmPDM_ERROR9.value: // History - REMOTE HAZ - case ALARM_TYPES.AlrmHAZ_REMOTE.value: - case ALARM_TYPES.AlrmHAZ_PUMP_ACTIVATE.value: - case ALARM_TYPES.AlrmADV_PUMP_AUTO_OFF.value: - case ALARM_TYPES.AlrmADV_PUMP_SUSPEND.value: - case ALARM_TYPES.AlrmADV_PUMP_EXP1.value: - case ALARM_TYPES.AlrmADV_PUMP_EXP2.value: - postalarm = postalarm.with_alarmType('other') - .with_payload({ - alarmText, - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .done(); - break; - // Pump advisory and hazard alarm (non-History) - // alarmType `low_insulin` - case ALARM_TYPES.AlrmADV_PUMP_VOL.value: - postalarm = postalarm.with_alarmType('low_insulin') - .with_payload({ - alarmText, - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .done(); - break; - // alarmType `no_insulin` - case ALARM_TYPES.AlrmHAZ_PUMP_VOL.value: - postsuspend = makeSuspended(alarm); - postbasal = makeSuspendBasal(alarm); - postalarm = postalarm.with_alarmType('no_insulin') - .with_payload({ - alarmText: getNameForValue(ALARM_TYPES, alarmValue), - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .with_status(postsuspend) - .done(); - break; - // alarmType `occlusion` - case ALARM_TYPES.AlrmHAZ_PUMP_OCCL.value: - postsuspend = makeSuspended(alarm); - postbasal = makeSuspendBasal(alarm); - postalarm = postalarm.with_alarmType('occlusion') - .with_payload({ - alarmText: getNameForValue(ALARM_TYPES, alarmValue), - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .with_status(postsuspend) - .done(); - break; - // alarmType `no_delivery` - case ALARM_TYPES.AlrmHAZ_PUMP_EXPIRED.value: - postsuspend = makeSuspended(alarm); - postbasal = makeSuspendBasal(alarm); - postalarm = postalarm.with_alarmType('no_delivery') - .with_payload({ - alarmText: getNameForValue(ALARM_TYPES, alarmValue), - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .with_status(postsuspend) - .done(); - break; - // alarmType `auto_off` - case ALARM_TYPES.AlrmHAZ_PDM_AUTO_OFF.value: - case ALARM_TYPES.AlrmHAZ_PUMP_AUTO_OFF.value: - // TODO: clarify with Insulet or get data to figure out whether this (below) is - // a warning or the actual auto-off; the spec is confused - postsuspend = makeSuspended(alarm); - postbasal = makeSuspendBasal(alarm); - postalarm = postalarm.with_alarmType('auto_off') - .with_payload({ - alarmText: getNameForValue(ALARM_TYPES, alarmValue), - explanation: ALARM_TYPES[alarmText].explanation, - stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, - }) - .with_status(postsuspend) - .done(); - break; - // for alarm codes not documented in the spec - default: - if (postalarm) { + if (postalarm != null) { + switch (alarmValue) { + // alarmType `other` + // History - ALARM + case ALARM_TYPES.AlrmADV_KEY.value: + case ALARM_TYPES.AlrmEXP_WARNING.value: + case ALARM_TYPES.AlrmSYSTEM_ERROR10.value: + case ALARM_TYPES.AlrmSYSTEM_ERROR12.value: + case ALARM_TYPES.AlrmSYSTEM_ERROR28.value: + case ALARM_TYPES.AlrmPDM_ERROR0.value: + case ALARM_TYPES.AlrmPDM_ERROR1.value: + case ALARM_TYPES.AlrmPDM_ERROR2.value: + case ALARM_TYPES.AlrmPDM_ERROR3.value: + case ALARM_TYPES.AlrmPDM_ERROR4.value: + case ALARM_TYPES.AlrmPDM_ERROR5.value: + case ALARM_TYPES.AlrmPDM_ERROR6.value: + case ALARM_TYPES.AlrmPDM_ERROR7.value: + case ALARM_TYPES.AlrmPDM_ERROR8.value: + case ALARM_TYPES.AlrmPDM_ERROR9.value: // History - REMOTE HAZ + case ALARM_TYPES.AlrmHAZ_REMOTE.value: + case ALARM_TYPES.AlrmHAZ_PUMP_ACTIVATE.value: + case ALARM_TYPES.AlrmADV_PUMP_AUTO_OFF.value: + case ALARM_TYPES.AlrmADV_PUMP_SUSPEND.value: + case ALARM_TYPES.AlrmADV_PUMP_EXP1.value: + case ALARM_TYPES.AlrmADV_PUMP_EXP2.value: postalarm = postalarm.with_alarmType('other') + .with_payload({ + alarmText, + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) .done(); - } - break; - } - if (postalarm != null) { + break; + // Pump advisory and hazard alarm (non-History) + // alarmType `low_insulin` + case ALARM_TYPES.AlrmADV_PUMP_VOL.value: + postalarm = postalarm.with_alarmType('low_insulin') + .with_payload({ + alarmText, + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) + .done(); + break; + // alarmType `no_insulin` + case ALARM_TYPES.AlrmHAZ_PUMP_VOL.value: + postsuspend = makeSuspended(alarm); + postbasal = makeSuspendBasal(alarm); + postalarm = postalarm.with_alarmType('no_insulin') + .with_payload({ + alarmText: getNameForValue(ALARM_TYPES, alarmValue), + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) + .with_status(postsuspend) + .done(); + break; + // alarmType `occlusion` + case ALARM_TYPES.AlrmHAZ_PUMP_OCCL.value: + postsuspend = makeSuspended(alarm); + postbasal = makeSuspendBasal(alarm); + postalarm = postalarm.with_alarmType('occlusion') + .with_payload({ + alarmText: getNameForValue(ALARM_TYPES, alarmValue), + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) + .with_status(postsuspend) + .done(); + break; + // alarmType `no_delivery` + case ALARM_TYPES.AlrmHAZ_PUMP_EXPIRED.value: + postsuspend = makeSuspended(alarm); + postbasal = makeSuspendBasal(alarm); + postalarm = postalarm.with_alarmType('no_delivery') + .with_payload({ + alarmText: getNameForValue(ALARM_TYPES, alarmValue), + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) + .with_status(postsuspend) + .done(); + break; + // alarmType `auto_off` + case ALARM_TYPES.AlrmHAZ_PDM_AUTO_OFF.value: + case ALARM_TYPES.AlrmHAZ_PUMP_AUTO_OFF.value: + // TODO: clarify with Insulet or get data to figure out whether this (below) is + // a warning or the actual auto-off; the spec is confused + postsuspend = makeSuspended(alarm); + postbasal = makeSuspendBasal(alarm); + postalarm = postalarm.with_alarmType('auto_off') + .with_payload({ + alarmText: getNameForValue(ALARM_TYPES, alarmValue), + explanation: ALARM_TYPES[alarmText].explanation, + stopsDelivery: ALARM_TYPES[alarmText].stopsDelivery, + }) + .with_status(postsuspend) + .done(); + break; + // for alarm codes not documented in the spec + default: + if (postalarm) { + postalarm = postalarm.with_alarmType('other') + .done(); + } + break; + } postrecords.push(postalarm); } if (postsuspend != null) { From 03b49b90012d7702dce08cd5014427913a953247 Mon Sep 17 00:00:00 2001 From: Gerrit Niezen Date: Wed, 15 Jul 2020 13:49:37 +0100 Subject: [PATCH 2/3] v2.32.0-alarmtype-null.1 --- app/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/package.json b/app/package.json index 89457a30a5..00b83999d7 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "tidepool-uploader", "productName": "tidepool-uploader", - "version": "2.32.0", + "version": "2.32.0-alarmtype-null.1", "description": "Tidepool Project Universal Uploader", "main": "./main.prod.js", "author": { diff --git a/package.json b/package.json index d0ff8bf1c3..4c13796383 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tidepool-uploader", - "version": "2.32.0", + "version": "2.32.0-alarmtype-null.1", "description": "Tidepool Project Universal Uploader", "private": true, "main": "main.prod.js", From f7288a24387410780eb6f3bdfeaa424ed2a92841 Mon Sep 17 00:00:00 2001 From: Gerrit Niezen Date: Tue, 28 Jul 2020 16:43:46 +0100 Subject: [PATCH 3/3] removed test suffix --- app/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/package.json b/app/package.json index 00b83999d7..89457a30a5 100644 --- a/app/package.json +++ b/app/package.json @@ -1,7 +1,7 @@ { "name": "tidepool-uploader", "productName": "tidepool-uploader", - "version": "2.32.0-alarmtype-null.1", + "version": "2.32.0", "description": "Tidepool Project Universal Uploader", "main": "./main.prod.js", "author": { diff --git a/package.json b/package.json index 79fa111bad..6fcefd7a53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tidepool-uploader", - "version": "2.32.0-alarmtype-null.1", + "version": "2.32.0", "description": "Tidepool Project Universal Uploader", "private": true, "main": "main.prod.js",