Fix cost per gram on inventory detail for discrete products
Build and push image / build (push) Successful in 17m4s

For discrete items, show "Cost per ct" using price/count instead of
dividing by countOriginal*unitWeight (which treated mg as grams for
edibles, showing $0.02 instead of $3.50).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 19:18:34 -04:00
parent 214a6ddaec
commit 52564d1e2f
+3 -3
View File
@@ -77,11 +77,11 @@ export function ProductDetail({
["Bin", isCheckedOut ? "In your custody" : bin ? bin.name : <span style={{ color: "var(--ink-3)" }}></span>],
["Audit cadence", `Every ${cfg?.cadenceDays ?? "—"} days · ${cfg?.auditMode ?? "—"}`],
[
"Cost per gram",
item.kind === "discrete" ? `Cost per ${cfg?.unit ?? "ct"}` : "Cost per gram",
item.kind === "bulk" && item.weight > 0
? fmt.money(item.price / item.weight)
: item.kind === "discrete" && item.unitWeight > 0
? `${fmt.money(item.price / (item.countOriginal * item.unitWeight))} (effective)`
: item.kind === "discrete" && item.countOriginal > 0
? fmt.money(item.price / item.countOriginal)
: "—",
],
];