From edb8e2ac922963c4a3245f22210074c3f6db738e Mon Sep 17 00:00:00 2001 From: josh Date: Sun, 3 May 2026 21:42:39 -0400 Subject: [PATCH] Bin slot count: discrete products fill by unit, not by row A 3ct pre-roll was filling one slot of its bin instead of three. Bins visualise physical capacity, so each unit of a discrete product (rolls, edibles, vapes) should take its own slot; bulk jars still take one slot each. The slot tally and fill bar both use the current count (countLastAudit ?? countOriginal) so the bin frees up as units are audited away. Co-Authored-By: Claude Opus 4.7 (1M context) --- web/src/views/BinsView.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/src/views/BinsView.tsx b/web/src/views/BinsView.tsx index b715af0..d1bd056 100644 --- a/web/src/views/BinsView.tsx +++ b/web/src/views/BinsView.tsx @@ -74,7 +74,14 @@ export function BinsView({ > {data.bins.map((bin) => { const items = data.products.filter((p) => p.binId === bin.id && p.status === "active"); - const fillPct = items.length / bin.capacity; + // Discrete products (pre-rolls, edibles, vapes) take a slot per unit; + // bulk products take one slot per jar/container. + const slotsUsed = items.reduce( + (s, p) => + s + (p.kind === "discrete" ? (p.countLastAudit ?? p.countOriginal) : 1), + 0, + ); + const fillPct = slotsUsed / bin.capacity; const totalValue = items.reduce( (s, p) => s + p.price * helpers.pctRemaining(p, TODAY_STR), 0, @@ -95,7 +102,7 @@ export function BinsView({ {bin.name}
- {items.length} / {bin.capacity} + {slotsUsed} / {bin.capacity}