Add container weight tracking for weigh-based concentrate audits
Build and push image / build (push) Successful in 1m6s
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user