Skip to content

Commit

Permalink
for purposes of categorizing boluses as SMBs to add to basalIOB, use …
Browse files Browse the repository at this point in the history
…max_daily_basal
  • Loading branch information
scottleibrand committed Aug 28, 2017
1 parent 947697a commit 4dbeec6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/iob/total.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ function iobTotal(opts, time) {
var tIOB = iobCalc(treatment, time, dia, profile_data);
if (tIOB && tIOB.iobContrib) iob += tIOB.iobContrib;
if (tIOB && tIOB.activityContrib) activity += tIOB.activityContrib;
// for purposes of categorizing boluses as SMBs to add to basalIOB, use max_daily_basal
if (typeof profile_data.maxSMBBasalMinutes == 'undefined' ) {
var maxSMB = profile_data.current_basal * 30 / 60;
var maxSMB = profile_data.max_daily_basal * 30 / 60;
//console.error("profile.maxSMBBasalMinutes undefined: defaulting to 30m");
} else {
var maxSMB = profile_data.current_basal * 60 / profile_data.maxSMBBasalMinutes;
var maxSMB = profile_data.max_daily_basal * 60 / profile_data.maxSMBBasalMinutes;
}
// keep track of bolus IOB separately for snoozes, but decay it twice as fast
// only snooze for boluses that deliver more than maxSMBBasalMinutes m worth of basal (excludes SMBs)
Expand Down

0 comments on commit 4dbeec6

Please sign in to comment.