Skip to content

Commit

Permalink
Treatment reminder only for 3 minutes in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
Navid200 committed Apr 1, 2024
1 parent efb3322 commit c36217e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<InsulinInjection> 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) + " / "
Expand Down

0 comments on commit c36217e

Please sign in to comment.