From c8a1a9cdb2f005b1f2f9a900a86c264485b0404f Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 28 Mar 2022 08:50:58 -0500 Subject: [PATCH 1/2] Show automatic bolus decisions from enacted field --- lib/plugins/loop.js | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/plugins/loop.js b/lib/plugins/loop.js index 5b86175cd79..be01c3ee4ee 100644 --- a/lib/plugins/loop.js +++ b/lib/plugins/loop.js @@ -231,7 +231,7 @@ function init (ctx) { , split: false , targets: false , reasons: reasonconf - , otp: true + , otp: true , submitHook: postLoopNotification }, { @@ -252,16 +252,16 @@ function init (ctx) { { val: 'Remote Carbs Entry' , name: 'Remote Carbs Entry' - , remoteCarbs: true - , remoteAbsorption: true - , otp: true + , remoteCarbs: true + , remoteAbsorption: true + , otp: true , submitHook: postLoopNotification }, { val: 'Remote Bolus Entry' , name: 'Remote Bolus Entry' - , remoteBolus: true - , otp: true + , remoteBolus: true + , otp: true , submitHook: postLoopNotification } ]; @@ -269,7 +269,7 @@ function init (ctx) { // TODO: Add event listener to customize labels - + loop.updateVisualisation = function updateVisualisation (sbx) { var prop = sbx.properties.loop; @@ -356,13 +356,22 @@ function init (ctx) { function addLastEnacted () { if (prop.lastEnacted) { - var canceled = prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0; + var canceled = ; - var valueParts = [ - 'Temp Basal' + (canceled ? ' Canceled' : ' Started') + '' - , canceled ? '' : ' ' + prop.lastEnacted.rate.toFixed(2) + 'U/hour for ' + prop.lastEnacted.duration + 'm' - , valueString(', ', prop.lastEnacted.reason) - ]; + var valueParts = [] + + if (prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0) { + valueParts.push('Temp Basal Canceled') + } + if (prop.lastEnacted.rate != null) { + valueParts.push('Temp Basal Started') + valueParts.push(' ' + prop.lastEnacted.rate.toFixed(2) + 'U/hour for ' + prop.lastEnacted.duration + 'm') + } + if (prop.lastEnacted.bolusVolume) { + valueParts.push('Automatic Bolus') + valueParts.push(' ' + prop.lastEnacted.bolusVolume + 'U') + } + valueParts.push(valueString(', ', prop.lastEnacted.reason)) valueParts = concatIOB(valueParts); valueParts = concatCOB(valueParts); From 9ce3920b7c505d93f80be3e41209f131e683f02d Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 28 Mar 2022 09:16:49 -0500 Subject: [PATCH 2/2] fix typo --- lib/plugins/loop.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/plugins/loop.js b/lib/plugins/loop.js index be01c3ee4ee..9deb85e60be 100644 --- a/lib/plugins/loop.js +++ b/lib/plugins/loop.js @@ -356,8 +356,6 @@ function init (ctx) { function addLastEnacted () { if (prop.lastEnacted) { - var canceled = ; - var valueParts = [] if (prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0) {