Skip to content

Commit

Permalink
Merge pull request #3415 from Navid200/Navid_2024_04_01
Browse files Browse the repository at this point in the history
Treatment reminder only for 3 minutes in the future
  • Loading branch information
jamorham authored May 22, 2024
2 parents 8cc5c66 + c36217e commit 5aee479
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 5aee479

Please sign in to comment.