Round insulin value in treatment tooltip (#6776)

* rename toFixedMin to toRoundedStr

* round the insulin value
This commit is contained in:
bassettb
2021-01-26 22:08:00 +02:00
committed by GitHub
parent 034eea9422
commit c91ec78af4
4 changed files with 21 additions and 17 deletions
+2 -2
View File
@@ -632,7 +632,7 @@ function init (client, d3) {
var glucose = treatment.glucose;
if (client.settings.units != client.ddata.profile.getUnits()) {
glucose *= (client.settings.units === 'mmol' ? (1 / consts.MMOL_TO_MGDL) : consts.MMOL_TO_MGDL);
var decimals = (client.settings.units === 'mmol' ? 10 : 1);
const decimals = (client.settings.units === 'mmol' ? 10 : 1);
glucose = Math.round(glucose * decimals) / decimals;
}
@@ -643,7 +643,7 @@ function init (client, d3) {
(treatment.protein ? '<strong>' + translate('Protein') + ':</strong> ' + treatment.protein + '<br/>' : '') +
(treatment.fat ? '<strong>' + translate('Fat') + ':</strong> ' + treatment.fat + '<br/>' : '') +
(treatment.absorptionTime > 0 ? '<strong>' + translate('Absorption Time') + ':</strong> ' + (Math.round(treatment.absorptionTime / 60.0 * 10) / 10) + 'h' + '<br/>' : '') +
(treatment.insulin ? '<strong>' + translate('Insulin') + ':</strong> ' + treatment.insulin + '<br/>' : '') +
(treatment.insulin ? '<strong>' + translate('Insulin') + ':</strong> ' + utils.toRoundedStr(treatment.insulin, 2) + '<br/>' : '') +
(treatment.enteredinsulin ? '<strong>' + translate('Combo Bolus') + ':</strong> ' + treatment.enteredinsulin + 'U, ' + treatment.splitNow + '% : ' + treatment.splitExt + '%, ' + translate('Duration') + ': ' + treatment.duration + '<br/>' : '') +
(treatment.glucose ? '<strong>' + translate('BG') + ':</strong> ' + glucose + (treatment.glucoseType ? ' (' + translate(treatment.glucoseType) + ')' : '') + '<br/>' : '') +
(treatment.enteredBy ? '<strong>' + translate('Entered By') + ':</strong> ' + treatment.enteredBy + '<br/>' : '') +