From edbf22b67e178910a76805208b4e011fa21a8ad4 Mon Sep 17 00:00:00 2001 From: PieterGit Date: Fri, 27 Oct 2017 21:18:32 +0200 Subject: [PATCH] bring back the ' U' for non-SMB's (> 1U insulin and with carbs) --- lib/client/renderer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/client/renderer.js b/lib/client/renderer.js index d92559926e8..15bb5544e5f 100644 --- a/lib/client/renderer.js +++ b/lib/client/renderer.js @@ -444,9 +444,13 @@ function init (client, d3) { } if ( treatment.insulin > 0) { + var dosage_units = Math.round(treatment.insulin * 100)/100; + var unit_of_measurement = ' U'; // One international unit of insulin (1 IU) is shown as '1 U' + if ( treatment.insulin < 1 && !treatment.carbs ) { // don't show the unit of measurement for insulin boluses < 1 without carbs (e.g. oref0 SMB's). Otherwise lot's of small insulin only dosages are often unreadable + unit_of_measurement = ''; + } // remove leading zeros to avoid overlap with adjacent boluses - var units = Math.round(treatment.insulin * 100)/100; - arc_data[3].element = (units+"").replace(/^0/,""); + arc_data[3].element = (dosage_units+"").replace(/^0/,"")+unit_of_measurement; } if (treatment.status) {