fix(reminders): an ended course reads as not reminding

The worker expands no slot past endsOn, so it never reminds for a
course that has ended, but remindersActive still read true for it. The
reminder gate now includes the course end on the person's clock, so the
published value, the worker and the admin check make the same decision.
This commit is contained in:
Marc-André Bombeck committed 2026-10-11 15:16:54 +02:00
1 parent 1ba422b87c
commit 24f06884b3
9 files changed
+142 -29

No files matched your search

@@ -185,7 +185,11 @@ export const POST = apiHandler(async (request: NextRequest) => {
// v1.42.2 — a medication whose doses are recorded automatically
// is never reminded, here or in the worker.
if (isOverdue && !hasEvent && sendsMedicationReminders(med)) {
if (
isOverdue &&
!hasEvent &&
sendsMedicationReminders(med, { now, timeZone: userTz })
) {
const doseInfo = schedule.dose ?? med.dose;
const timeWindow = `${schedule.windowStart}–${schedule.windowEnd}`;