Add container weight tracking for weigh-based concentrate audits
Build and push image / build (push) Successful in 1m6s

Record the total weight of a jar (product + container) at acquisition so
audits can be done by simply re-weighing the sealed jar. The tare is
derived (containerWeight − productWeight), and the audit flow offers a
"Weigh container" toggle that auto-calculates remaining product from the
scale reading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 23:11:39 -04:00
parent e9e66ab1cb
commit a1be29ab6e
11 changed files with 205 additions and 26 deletions
+5
View File
@@ -38,6 +38,7 @@ export interface InventoryItem {
cbd: number;
totalCannabinoids: number;
weight: number;
containerWeight: number | null;
lastAuditWeight: number | null;
countOriginal: number;
countLastAudit: number | null;
@@ -183,6 +184,10 @@ export const helpers = {
typeConfig(id: string): TypeConfig {
return TYPES.find((t) => t.id === id) ?? TYPES[0]!;
},
tare(item: { containerWeight: number | null; weight: number }): number | null {
if (item.containerWeight == null) return null;
return item.containerWeight - item.weight;
},
daysSince(iso: string | null, today = TODAY_STR): number {
if (!iso) return Infinity;
return Math.floor((+new Date(today) - +new Date(iso)) / 86_400_000);