fix total amount
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user