Skip to content

Commit

Permalink
Added additonal logic for HAPP Temp basals (#370)
Browse files Browse the repository at this point in the history
* Added additonal logic for HAPP Temp basals

Needed to change the timestamp and rate to created_at and absolute respectively.

* Update history.js

* Update history.js
  • Loading branch information
taylorfowler authored and scottleibrand committed Jan 31, 2017
1 parent e4dcfb1 commit 68eec9b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/iob/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 68eec9b

Please sign in to comment.