Internal
Public Access
Delay overdue notification an hour, retroactively apply reminder setting
Two refinements from live testing of the reminder feature: - Due-time tasks scheduled "due now" and "overdue" at the exact same moment. Task._due_and_overdue_moments() now delays "overdue" by an hour so they don't arrive together. The overdue badge/styling elsewhere is unaffected - only this notification's timing changes. - Task.reschedule_reminders() only captures user.default_reminder_minutes at the moment a task's own due_date/due_time is set, so changing the profile setting didn't reach tasks whose due date was already set. User.save() now detects a change to that setting and calls the new User.reschedule_reminder_notifications(), which recomputes the "before due" reminder on active due tasks that don't have their own explicit reminder_at override. 8 new/updated tests cover the overdue delay and the retroactive rescheduling (including that unrelated profile saves and tasks with an explicit reminder_at are left untouched). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
a27fcc4c69
commit
f92ce7a3d4
+3
-1
@@ -188,7 +188,9 @@ class Task(models.Model):
|
||||
|
||||
if self.due_time:
|
||||
due_moment = datetime.combine(self.due_date, self.due_time, tzinfo=user_tz)
|
||||
return due_moment, due_moment
|
||||
# Give "overdue" some breathing room after "due now" instead of
|
||||
# firing both notifications at the exact same moment.
|
||||
return due_moment, due_moment + timedelta(hours=1)
|
||||
|
||||
overdue_moment = datetime.combine(self.due_date + timedelta(days=1), dt_time.min, tzinfo=user_tz)
|
||||
return None, overdue_moment
|
||||
|
||||
Reference in New Issue
Block a user