Problem
The LighterPack import parser stores price in cents, while the rest of the app treats price as major currency units. Imported prices end up ×100 too large when displayed and persisted.
Evidence
- Parser (
pkg/packs/lighterpack.go, extractItemPrice): converts $399.50 → 39950 (cents). ExternalPackItem.Price is documented/handled as cents.
- App convention (frontend inventory creation,
js/ui/inventory.ui.js): price: parseInt(value) — stores the entered value as-is (major units, e.g. 299).
- Display (
js/public-pack.js createItemRow, mirrored in the new js/try-lighterpack.js): ${currency}${price.toFixed(2)} — assumes major units. So an imported 39950 renders as EUR39950.00 instead of €399.50.
Scope (pre-existing, not introduced by the anonymous-import feature)
This affects:
- The existing authenticated imports:
POST /v1/importfromlighterpackurl, POST /v1/importfromlighterpack (CSV), POST /v1/importfrompimpmypackurl — all go through insertExternalPack and persist cents.
- The new anonymous flow (frontend PR Angak0k/pimpmypack-front#89) and the new
POST /v1/importpack — surfaced the issue during QA but inherit the same parser convention.
- Shared display code in
public-pack.js (and replicated in try-lighterpack.js).
Decision needed
Pick the canonical unit for price and align both sides. Likely fix: make the parser emit major units (consistent with inventory creation and the toFixed(2) display), or normalize at the API boundary. Either way, audit extractItemPrice + insertExternalPack + the import display paths together.
Noted as a follow-up; intentionally left out of the current LighterPack-import PRs (#248 backend, Angak0k/pimpmypack-front#89 frontend) per QA decision.
Problem
The LighterPack import parser stores
pricein cents, while the rest of the app treatspriceas major currency units. Imported prices end up ×100 too large when displayed and persisted.Evidence
pkg/packs/lighterpack.go,extractItemPrice): converts$399.50→39950(cents).ExternalPackItem.Priceis documented/handled as cents.js/ui/inventory.ui.js):price: parseInt(value)— stores the entered value as-is (major units, e.g.299).js/public-pack.jscreateItemRow, mirrored in the newjs/try-lighterpack.js):${currency}${price.toFixed(2)}— assumes major units. So an imported39950renders asEUR39950.00instead of€399.50.Scope (pre-existing, not introduced by the anonymous-import feature)
This affects:
POST /v1/importfromlighterpackurl,POST /v1/importfromlighterpack(CSV),POST /v1/importfrompimpmypackurl— all go throughinsertExternalPackand persist cents.POST /v1/importpack— surfaced the issue during QA but inherit the same parser convention.public-pack.js(and replicated intry-lighterpack.js).Decision needed
Pick the canonical unit for
priceand align both sides. Likely fix: make the parser emit major units (consistent with inventory creation and thetoFixed(2)display), or normalize at the API boundary. Either way, auditextractItemPrice+insertExternalPack+ the import display paths together.Noted as a follow-up; intentionally left out of the current LighterPack-import PRs (#248 backend, Angak0k/pimpmypack-front#89 frontend) per QA decision.