fix(inventory): serialise unknown units as null, not 0 (iOS shows unknown, no phantom negatives)

This commit is contained in:
Marc-André Bombeck committed 2026-06-17 14:09:42 +02:00
commit fcd498d252
12 files changed
+146 -30

No files matched your search

+11 -4
View File
@@ -11992,14 +11992,21 @@ components:
description: Kind of physical container (PEN / AMPOULE / BLISTER / INHALER / BOTTLE / OTHER). Display-level
classification; defaults to OTHER.
unitsTotal:
type: number
anyOf:
- type: number
- type: "null"
description: Units the container shipped with (tablets / ampoules / puffs; 1–1000). v1.16.12 — fractional, so a
split-pill remainder reads cleanly. Dose-derived readouts divide by the medication's `unitsPerDose`.
split-pill remainder reads cleanly. Dose-derived readouts divide by the medication's `unitsPerDose`. v1.18.3
(iOS#31) — NULL when the unit count is unknown (a corrupt or legacy row); the client renders "unknown",
never a fabricated 0.
unitsRemaining:
type: number
anyOf:
- type: number
- type: "null"
description: Units left in the container. v1.16.12 — fractional (a ½-tablet dose leaves 29.5 of 30). Decremented by the
intake consumption hook (FEFO with spillover across containers); refunded when a taken dose is skipped,
edited away, or deleted.
edited away, or deleted. v1.18.3 (iOS#31) — NULL when the count is unknown (a corrupt or legacy row); the
client renders "unknown", never a fabricated 0 it could decrement into negatives.
firstUseAt:
anyOf:
- type: string