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

More mdt glucose fixes #181

Merged
merged 9 commits into from Jul 31, 2016
@@ -48,9 +48,11 @@ var getLastGlucose = function (data) {
} else {
secondtolast = data[0];
}

var older_date = secondtolast.date || Date.parse(secondtolast.display_time);
twochange = now.glucose - secondtolast.glucose;
if (typeof secondtolast.date !== 'undefined' && typeof now.date !== 'undefined') {
minutes = Math.round( (now.date - secondtolast.date) / (1000 * 60) );
if (typeof older_date !== 'undefined' && typeof now_date !== 'undefined') {
minutes = Math.round( (now_date - older_date) / (1000 * 60) );
console.error("Two data point lookback", minutes, "minutes");
// multiply by 5 to get the same units as delta, i.e. mg/dL/5m
twoavg = twochange/minutes * 5;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.