mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
A supply container went EXPIRED 30 days after its first use no matter what kind of container it was. That window exists because puncturing an injection pen exposes its contents and the product information caps how long the rest stays usable; a blister of tablets has no such limit, every tablet sits in its own sealed cavity, and pressing the first one out says nothing about the rest. The state machine never read `containerType`, so a tablet pack opened five weeks ago had its remaining stock written off. The clock now keys off the container kind. PEN and AMPOULE carry it: both are a single sealed reservoir that the first dose breaches. BLISTER, INHALER, BOTTLE and OTHER do not: their units stay individually sealed, or the arrangement is simply unknown, and a fixed 30 days would be a number nobody entered. The printed expiry still applies to every kind, so an unknown container is not an unbounded one. `computeExpiresAt` takes the kind too, so a clock-less container with no printed date now persists no `expiresAt` at all and the daily expire scan never sees it. The per-item PATCH gains a way back out: `markAsFirstUseAt` accepts null and clears the opening date, which is the correction a container needs after the intake hook auto-opened it from a back-dated dose. Also drops `daysRemainingInUse`. It had no caller anywhere in the tree and its docblock described a chip that does not exist.
1.1 MiB
1.1 MiB