From a75e4d28cfd9a74d32d515e492b49bae11dd00c1 Mon Sep 17 00:00:00 2001 From: taylorfowler Date: Tue, 31 Jan 2017 13:57:57 -0500 Subject: [PATCH 1/3] Added additonal logic for HAPP Temp basals Needed to change the timestamp and rate to created_at and absolute respectively. --- lib/iob/history.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/iob/history.js b/lib/iob/history.js index 1449b678..4fe92b9e 100644 --- a/lib/iob/history.js +++ b/lib/iob/history.js @@ -109,6 +109,15 @@ function calcTempTreatments (inputs) { temp.date = temp.started_at.getTime(); temp.insulin = current.insulin; tempBoluses.push(temp); + } else if (current.eventType == "Temp Basal" && current.enteredBy=="HAPP_App") { + var temp = {}; + temp.rate = current.absolute; + temp.duration = current.duration; + temp.timestamp = current.created_at; + temp.started_at = new Date(tz(temp.timestamp)); + temp.date = temp.started_at.getTime(); + temp.duration = current.duration; + tempHistory.push(temp); } else if (current.eventType == "Temp Basal") { var temp = {}; temp.rate = current.rate; From b5dc76f3f5c9c16f78e434bdb50116939c470b8d Mon Sep 17 00:00:00 2001 From: taylorfowler Date: Tue, 31 Jan 2017 14:46:43 -0500 Subject: [PATCH 2/3] Update history.js --- lib/iob/history.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/iob/history.js b/lib/iob/history.js index 4fe92b9e..1449b678 100644 --- a/lib/iob/history.js +++ b/lib/iob/history.js @@ -109,15 +109,6 @@ function calcTempTreatments (inputs) { temp.date = temp.started_at.getTime(); temp.insulin = current.insulin; tempBoluses.push(temp); - } else if (current.eventType == "Temp Basal" && current.enteredBy=="HAPP_App") { - var temp = {}; - temp.rate = current.absolute; - temp.duration = current.duration; - temp.timestamp = current.created_at; - temp.started_at = new Date(tz(temp.timestamp)); - temp.date = temp.started_at.getTime(); - temp.duration = current.duration; - tempHistory.push(temp); } else if (current.eventType == "Temp Basal") { var temp = {}; temp.rate = current.rate; From cdd242fc3ff1ea803a355a568c71576fdba70f1a Mon Sep 17 00:00:00 2001 From: taylorfowler Date: Tue, 31 Jan 2017 14:49:32 -0500 Subject: [PATCH 3/3] Update history.js --- lib/iob/history.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/iob/history.js b/lib/iob/history.js index 080715c2..ab680788 100644 --- a/lib/iob/history.js +++ b/lib/iob/history.js @@ -116,6 +116,15 @@ function calcTempTreatments (inputs) { temp.date = temp.started_at.getTime(); temp.insulin = current.insulin; tempBoluses.push(temp); + } else if (current.eventType == "Temp Basal" && current.enteredBy=="HAPP_App") { + var temp = {}; + temp.rate = current.absolute; + temp.duration = current.duration; + temp.timestamp = current.created_at; + temp.started_at = new Date(tz(temp.timestamp)); + temp.date = temp.started_at.getTime(); + temp.duration = current.duration; + tempHistory.push(temp); } else if (current.eventType == "Temp Basal") { var temp = {}; temp.rate = current.rate;