From c36217eb705293c1a34afb17dad46d92bfefa18d Mon Sep 17 00:00:00 2001 From: Navid Date: Mon, 1 Apr 2024 09:23:03 -0400 Subject: [PATCH] Treatment reminder only for 3 minutes in the future --- .../java/com/eveningoutpost/dexdrip/models/Treatments.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/models/Treatments.java b/app/src/main/java/com/eveningoutpost/dexdrip/models/Treatments.java index a328958da..fdcb7de63 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/models/Treatments.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/models/Treatments.java @@ -249,13 +249,14 @@ public static synchronized Treatments create(final double carbs, final double in } public static synchronized Treatments create(final double carbs, final double insulinSum, final List insulin, long timestamp, String suggested_uuid) { - // if treatment more than 1 minutes in the future final long future_seconds = (timestamp - JoH.tsl()) / 1000; + // if treatment more than 1 hour in the future if (future_seconds > (60 * 60)) { JoH.static_toast_long("Refusing to create a treatement more than 1 hours in the future!"); return null; } - if ((future_seconds > 60) && (future_seconds < 86400) && ((carbs > 0) || (insulinSum > 0))) { + // if treatment more than 3 minutes in the future + if ((future_seconds > (3 * 60)) && (future_seconds < 86400) && ((carbs > 0) || (insulinSum > 0))) { final Context context = xdrip.getAppContext(); JoH.scheduleNotification(context, "Treatment Reminder", "@" + JoH.hourMinuteString(timestamp) + " : " + carbs + " g " + context.getString(R.string.carbs) + " / "