From bb42109c32f6064785403e0c05a5424969bc2276 Mon Sep 17 00:00:00 2001 From: Syco21 Date: Fri, 27 Mar 2026 21:28:44 +0100 Subject: [PATCH] fix total amount --- src/components/CardRow/CardRow.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/CardRow/CardRow.jsx b/src/components/CardRow/CardRow.jsx index b19e7f3..096bc74 100644 --- a/src/components/CardRow/CardRow.jsx +++ b/src/components/CardRow/CardRow.jsx @@ -8,9 +8,10 @@ function CardRow({ card }) { const toggleExpand = () => setExpandedCardId(isExpanded ? null : card.id); - // Calculate total owned across all printings + // ✅ Calculate total owned across all printings using combined key const totalOwned = card.printings?.reduce((sum, p) => { - const owned = ownedAmounts[card.id]?.[p.set_id] ?? p.amount_owned ?? 0; + const key = `${p.set_id}-${p.rarity_id}`; + const owned = ownedAmounts[card.id]?.[key] ?? p.amount_owned ?? 0; return sum + owned; }, 0) ?? 0;