Fix cost per gram on inventory detail for discrete products
Build and push image / build (push) Successful in 17m4s
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:
@@ -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)
|
||||
: "—",
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user