From 78115d0be3572415fc417e3240cab056292e519e Mon Sep 17 00:00:00 2001 From: drnoname82 Date: Tue, 5 Sep 2017 00:32:32 +0200 Subject: [PATCH 1/3] Update openaps.js --- lib/plugins/openaps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/openaps.js b/lib/plugins/openaps.js index 0541be4b9ec..0b721365031 100644 --- a/lib/plugins/openaps.js +++ b/lib/plugins/openaps.js @@ -108,8 +108,8 @@ function init(ctx) { function toMoments (status) { return { when: moment(status.mills) - , enacted: status.openaps.enacted && status.openaps.enacted.timestamp && status.openaps.enacted.recieved && moment(status.openaps.enacted.timestamp) - , notEnacted: status.openaps.enacted && status.openaps.enacted.timestamp && !status.openaps.enacted.recieved && moment(status.openaps.enacted.timestamp) + , enacted: status.openaps.enacted && status.openaps.enacted.timestamp && (status.openaps.enacted.recieved || status.openaps.enacted.received) && moment(status.openaps.enacted.timestamp) + , notEnacted: status.openaps.enacted && status.openaps.enacted.timestamp && !(status.openaps.enacted.recieved || status.openaps.enacted.recieved) && moment(status.openaps.enacted.timestamp) , suggested: status.openaps.suggested && status.openaps.suggested.timestamp && moment(status.openaps.suggested.timestamp) , iob: status.openaps.iob && status.openaps.iob.timestamp && moment(status.openaps.iob.timestamp) }; From 753b7f66ba79d497409dccd878b5bfdd02450e3c Mon Sep 17 00:00:00 2001 From: drnoname82 Date: Tue, 5 Sep 2017 21:06:54 +0200 Subject: [PATCH 2/3] Update openaps.js --- lib/plugins/openaps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/openaps.js b/lib/plugins/openaps.js index 0b721365031..9e3273825ef 100644 --- a/lib/plugins/openaps.js +++ b/lib/plugins/openaps.js @@ -109,7 +109,7 @@ function init(ctx) { return { when: moment(status.mills) , enacted: status.openaps.enacted && status.openaps.enacted.timestamp && (status.openaps.enacted.recieved || status.openaps.enacted.received) && moment(status.openaps.enacted.timestamp) - , notEnacted: status.openaps.enacted && status.openaps.enacted.timestamp && !(status.openaps.enacted.recieved || status.openaps.enacted.recieved) && moment(status.openaps.enacted.timestamp) + , notEnacted: status.openaps.enacted && status.openaps.enacted.timestamp && !(status.openaps.enacted.recieved || status.openaps.enacted.received) && moment(status.openaps.enacted.timestamp) , suggested: status.openaps.suggested && status.openaps.suggested.timestamp && moment(status.openaps.suggested.timestamp) , iob: status.openaps.iob && status.openaps.iob.timestamp && moment(status.openaps.iob.timestamp) }; From c0f22fd8e7e7214dc92fe796c144c6d3c2375935 Mon Sep 17 00:00:00 2001 From: drnoname82 Date: Tue, 5 Sep 2017 21:33:18 +0200 Subject: [PATCH 3/3] Update openaps.test.js Test for devicestatus-entries containing the correct spelling of the word "received" instead of "recieved" in OpenAPS versions 0.6.0 and later --- tests/openaps.test.js | 115 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/tests/openaps.test.js b/tests/openaps.test.js index 7a106041dbf..798e3519960 100644 --- a/tests/openaps.test.js +++ b/tests/openaps.test.js @@ -124,6 +124,121 @@ var statuses = [{ tick: '+1' } } +} +,{ + "_id": { + "$oid": "59aef8cb444d1500109fc8fd" + }, + "device": "openaps://edi1", + "openaps": { + "iob": { + "iob": 1.016, + "activity": 0.0143, + "bolussnooze": 0, + "basaliob": 0.893, + "netbasalinsulin": 0.7, + "hightempinsulin": 2.5, + "microBolusInsulin": 1.7, + "microBolusIOB": 0.933, + "lastBolusTime": 1504638182000, + "timestamp": "2017-09-05T19:18:31.000Z" + }, + "suggested": { + "insulinReq": -0.06, + "bg": 117, + "reservoir": "104.5", + "temp": "absolute", + "snoozeBG": 80, + "rate": 0.75, + "minPredBG": 78, + "IOB": 1.016, + "reason": "COB: 0, Dev: -6, BGI: -2.22, ISF: 31, Target: 80, minPredBG 78, IOBpredBG 78; Eventual BG 80 >= 80, insulinReq -0.06. temp 0.2<0.75U/hr. ", + "COB": 0, + "eventualBG": 80, + "duration": 30, + "tick": -3, + "deliverAt": "2017-09-05T19:18:43.563Z", + "timestamp": "2017-09-05T19:18:43.000Z" + }, + "enacted": { + "insulinReq": -0.06, + "received": true, + "bg": 117, + "reservoir": "104.5", + "temp": "absolute", + "snoozeBG": 80, + "timestamp": "2017-09-05T19:18:49.000Z", + "predBGs": { + "IOB": [ + 117, + 114, + 111, + 108, + 106, + 104, + 102, + 100, + 98, + 97, + 96, + 95, + 94, + 93, + 92, + 91, + 90, + 89, + 88, + 87, + 86, + 86, + 85, + 84, + 83, + 83, + 82, + 81, + 81, + 81, + 80, + 80, + 79, + 79, + 79, + 79, + 78 + ] + }, + "minPredBG": 78, + "deliverAt": "2017-09-05T19:18:43.563Z", + "duration": 30, + "rate": 0.75, + "COB": 0, + "eventualBG": 80, + "reason": "COB: 0, Dev: -6, BGI: -2.22, ISF: 31, Target: 80, minPredBG 78, IOBpredBG 78; Eventual BG 80 >= 80, insulinReq -0.06. temp 0.2<0.75U/hr. ", + "tick": -3, + "IOB": 1.016 + } + }, + "pump": { + "clock": "2017-09-05T21:18:31+02:00", + "battery": { + "status": "normal", + "voltage": 1.55 + }, + "reservoir": 104.5, + "status": { + "status": "normal", + "bolusing": false, + "suspended": false, + "timestamp": "2017-09-05T19:18:29.000Z" + } + }, + "uploader": { + "batteryVoltage": 4131, + "battery": 95 + }, + "created_at": "2017-09-05T19:19:39.899Z" }]; var now = moment(statuses[0].created_at);