Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treatment reminder only for 3 minutes in the future #3415

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading