cmd/format.go::strippedSuffix has the suffix table:
{"Kcal", "kcal"},
{"Mg", "mg"},
{"Ug", "µg"},
{"UI", "IU"},
{"G", "g"},
But the struct field is VitaminDIU (ends in IU, not UI) — standard international-units abbreviation:
// internal/cronoapi/records.go:65
VitaminDIU float64 \`json:"VitaminDIU"\`
So the "UI" entry never matches, and strippedSuffix("VitaminDIU") returns ("VitaminDIU", "") — markdown renders without a unit and without splitting the name. Reproduced standalone:
VitaminDIU -> "VitaminDIU" unit=""
VitaminAUg -> "VitaminA" unit="µg"
VitaminCMg -> "VitaminC" unit="mg"
Real-world impact: any markdown serving with non-zero vitamin D shows up as
instead of
Fix: change the table entry to {"IU", "IU"}. (No other field ends in UI, so the old entry was dead code from the start.) Add a unit test for strippedSuffix covering one field per suffix — would have caught this on day one.
Severity: minor (cosmetic, but visible to every user with vitamin D logged)
cmd/format.go::strippedSuffixhas the suffix table:{"Kcal", "kcal"}, {"Mg", "mg"}, {"Ug", "µg"}, {"UI", "IU"}, {"G", "g"},But the struct field is
VitaminDIU(ends inIU, notUI) — standard international-units abbreviation:So the
"UI"entry never matches, andstrippedSuffix("VitaminDIU")returns("VitaminDIU", "")— markdown renders without a unit and without splitting the name. Reproduced standalone:Real-world impact: any markdown serving with non-zero vitamin D shows up as
instead of
Fix: change the table entry to
{"IU", "IU"}. (No other field ends inUI, so the old entry was dead code from the start.) Add a unit test forstrippedSuffixcovering one field per suffix — would have caught this on day one.Severity: minor (cosmetic, but visible to every user with vitamin D logged)