From 14ca67b488f7c252f99f6680b1f428e5576ae822 Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 1 Oct 2021 16:48:23 +0200 Subject: [PATCH] Fix missing boluses --- .../androidaps/plugins/pump/insight/LocalInsightPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 56cac1b6c7..a490aa9553 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -1557,8 +1557,6 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai } private long parseRelativeDate(int year, int month, int day, int hour, int minute, int second, int relativeHour, int relativeMinute, int relativeSecond) { - if (relativeHour * 60 * 60 + relativeMinute * 60 + relativeSecond >= hour * 60 * 60 * minute * 60 + second) - day--; Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); @@ -1566,7 +1564,9 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai calendar.set(Calendar.HOUR_OF_DAY, relativeHour); calendar.set(Calendar.MINUTE, relativeMinute); calendar.set(Calendar.SECOND, relativeSecond); - return calendar.getTimeInMillis(); + long dayOffset = + relativeHour * 60 * 60 + relativeMinute * 60 + relativeSecond >= hour * 60 * 60 + minute * 60 + second ? T.Companion.days(1).msecs() : 0L; + return calendar.getTimeInMillis() - dayOffset; } private void uploadCareportalEvent(long date, DetailedBolusInfo.EventType event) {