Fix nagging for doses not yet due — check scheduled time before nagging
should_send_nag() was iterating all pending schedules for today without verifying the scheduled time had actually passed. A dose scheduled for 18:00 would get nagged at 13:15. Add an early return when current_time is before the scheduled dose time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -245,6 +245,13 @@ def should_send_nag(
|
||||
"""
|
||||
scheduled_time = _normalize_time(scheduled_time)
|
||||
|
||||
# Don't nag for doses that aren't due yet
|
||||
if scheduled_time:
|
||||
sched_hour, sched_min = int(scheduled_time[:2]), int(scheduled_time[3:5])
|
||||
sched_as_time = time(sched_hour, sched_min)
|
||||
if current_time.time() < sched_as_time:
|
||||
return False, "Not yet due"
|
||||
|
||||
settings = get_adaptive_settings(user_uuid)
|
||||
if not settings:
|
||||
return False, "No settings"
|
||||
|
||||
Reference in New Issue
Block a user