fix total amount

This commit is contained in:
2026-03-27 21:28:44 +01:00
parent 9f9e6ec86c
commit bb42109c32
+3 -2
View File
@@ -8,9 +8,10 @@ function CardRow({ card }) {
const toggleExpand = () => setExpandedCardId(isExpanded ? null : card.id); 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 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; return sum + owned;
}, 0) ?? 0; }, 0) ?? 0;