Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering of Care Portal entries that do not define BG... #479

Closed
wants to merge 9 commits into from
11 changes: 10 additions & 1 deletion static/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,16 @@ var app = {}, browserSettings = {}, browserStorage = $.localStorage;
//TODO: store units in db per treatment, and use that for conversion, until then assume glucose doesn't need to be scaled
// Care Portal treatment form does ask for the display units to be used
// other option is to convert on entry, but then need to correctly identify/handel old data
return treatment.glucose || scaleBg(calcBGByTime(treatment.created_at.getTime()));
var rval = treatment.glucose || scaleBg(calcBGByTime(treatment.created_at.getTime()));

// Deal with careportal entries that don't define contain a BG value
if (isNaN(rval)) {
var ceiling = 450;
if (browserSettings.units == 'mmol') ceiling = 22;
return ceiling;
}

return rval;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down