Skip to content

Commit

Permalink
Fix mmol conversion on treatment save
Browse files Browse the repository at this point in the history
  • Loading branch information
sulkaharo committed Jul 8, 2018
1 parent 17328a3 commit d48825b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/client/careportal.js
Expand Up @@ -208,7 +208,7 @@ function init (client, $) {
, units: client.settings.units
};

if (units = "mmol") {
if (units == "mmol") {
data.targetTop = data.targetTop * 18;
data.targetBottom = data.targetBottom * 18;
}
Expand Down Expand Up @@ -270,8 +270,17 @@ function init (client, $) {
pushIf(data.glucose, translate('Measurement Method') + ': ' + translate(data.glucoseType));

pushIf(data.reason, translate('Reason') + ': ' + data.reason);
pushIf(data.targetTop, translate('Target Top') + ': ' + data.targetTop);
pushIf(data.targetBottom, translate('Target Bottom') + ': ' + data.targetBottom);

var targetTop = data.targetTop;
var targetBottom = data.targetBottom;

if (units == "mmol") {
targetTop = Math.round(data.targetTop / 18.0 * 10) / 10;
targetBottom = Math.round(data.targetBottom / 18.0 * 10) / 10;
}

pushIf(data.targetTop, translate('Target Top') + ': ' + targetTop);
pushIf(data.targetBottom, translate('Target Bottom') + ': ' + targetBottom);

pushIf(data.carbs, translate('Carbs Given') + ': ' + data.carbs);
pushIf(data.insulin, translate('Insulin Given') + ': ' + data.insulin);
Expand Down

0 comments on commit d48825b

Please sign in to comment.