From 52564d1e2f93747723bc120886c147fb777c4d57 Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 24 May 2026 19:18:34 -0400 Subject: [PATCH] Fix cost per gram on inventory detail for discrete products 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 --- web/src/components/ProductDetail.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/components/ProductDetail.tsx b/web/src/components/ProductDetail.tsx index 4c5ca89..4bb84c1 100644 --- a/web/src/components/ProductDetail.tsx +++ b/web/src/components/ProductDetail.tsx @@ -77,11 +77,11 @@ export function ProductDetail({ ["Bin", isCheckedOut ? "In your custody" : bin ? bin.name : ], ["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) : "—", ], ];