mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
Closes the v1.4.39.4 hook gap surfaced by the QA reconcile pass. The `scope=today` branch's bulk `createMany` mints fresh `(medicationId, scheduledFor)` PENDING rows when the morning projection lands; without this hook the compliance rollup for the affected `(user, medication, day)` tuples stays at its pre-projection `scheduled` count, inflating the apparent compliance % until the user actually logs against the new row. Fires `recomputeMedicationComplianceForEvent` once per distinct `(medication_id, dayKey)` (coalesced by Set) so a 5-meds-3-times-a- day projection drops 15 createMany rows down to ≤3 recompute round- trips. Best-effort: errors stay caught inside the helper so a populator hiccup doesn't surface as a 5xx on the intake request.