mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
The write-path convergence stops new duplicate slot rows, but accounts that already accrued a pending + taken pair for one dose keep an inflated expected count, a phantom taken marker, and a suppressed "due now" prompt until the bad rows are cleared. Add a boot-time, idempotent cleanup queue (mirroring the existing backfill queues): discover only the users holding a same-slot duplicate, then per medication snap every live intake to its canonical slot, keep the most-actioned row per slot (taken over skipped over pending), normalise its instant, soft-delete the losers, and recompute the affected compliance rollups. Rows that resolve to no scheduled slot (PRN / as-needed) are never collapsed. A second pass is a no-op. Registered in the worker's queue list with a static guard test, after a prior incident where a queue was built but never registered and silently never ran.