From 3006c00c7b58909b5f8f0cbd12d8f787441628fc Mon Sep 17 00:00:00 2001 From: Sulka Haro Date: Sun, 12 Feb 2023 21:47:21 +0200 Subject: [PATCH] Add event type to event on treatment notify if it's missing --- lib/plugins/treatmentnotify.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/plugins/treatmentnotify.js b/lib/plugins/treatmentnotify.js index 40216d97ace..be76b8cac5f 100644 --- a/lib/plugins/treatmentnotify.js +++ b/lib/plugins/treatmentnotify.js @@ -123,6 +123,11 @@ function init(ctx) { message = '...'; } + if (!eventType && lastTreatment.carbs && lastTreatment.insulin) eventType = "Meal Bolus"; + if (!eventType && lastTreatment.carbs) eventType = "Carb Correction"; + if (!eventType && lastTreatment.insulin) eventType = "Correcton Bolus"; + if (!eventType) eventType = "Note"; + const hash = crypto.createHash('sha1'); const info = JSON.stringify({ eventType, timestamp}); hash.update(info);