From adc84396d907b64492ec6fa29b0390acf6c32bd5 Mon Sep 17 00:00:00 2001 From: Micha Grueninger Date: Sat, 18 Apr 2026 22:29:34 +0200 Subject: [PATCH] (fix) multiply item weight_grams by quantity in bag total weight calculation --- client/src/components/Packing/PackingListPanel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/Packing/PackingListPanel.tsx b/client/src/components/Packing/PackingListPanel.tsx index 9311cbc1..80a9850c 100644 --- a/client/src/components/Packing/PackingListPanel.tsx +++ b/client/src/components/Packing/PackingListPanel.tsx @@ -1311,8 +1311,8 @@ export default function PackingListPanel({ tripId, items, openImportSignal = 0, {bags.map(bag => { const bagItems = items.filter(i => i.bag_id === bag.id) - const totalWeight = bagItems.reduce((sum, i) => sum + (i.weight_grams || 0), 0) - const maxWeight = bag.weight_limit_grams || Math.max(...bags.map(b => items.filter(i => i.bag_id === b.id).reduce((s, i) => s + (i.weight_grams || 0), 0)), 1) + const totalWeight = bagItems.reduce((sum, i) => sum + (i.weight_grams * i.quantity || 0), 0) + const maxWeight = bag.weight_limit_grams || Math.max(...bags.map(b => items.filter(i => i.bag_id === b.id).reduce((s, i) => s + (i.weight_grams * i.quantity || 0), 0)), 1) const pct = Math.min(100, Math.round((totalWeight / maxWeight) * 100)) return ( handleDeleteBag(bag.id)} onUpdate={handleUpdateBag} onSetMembers={handleSetBagMembers} t={t} compact />