Remove quantity field; normalize missing prices to 0,00 €

Each collection row is a unique card (own condition/notes), so quantity
was noise: dropped the field in Directus and removed it from the add
dialog, collection/grid/table views, dashboard stats and sort options.
Cards without Cardmarket data now consistently show 0,00 € (base price
row is always displayed on the card page).
This commit is contained in:
2026-07-29 00:07:53 +02:00
parent 1cfbf1db49
commit 9d3261718f
8 changed files with 12 additions and 66 deletions
+4 -4
View File
@@ -20,9 +20,10 @@ export const variantPriceMap: Record<string, string> = {
};
/**
* Resolve the Cardmarket unit price and line total for each collection card.
* Resolve the Cardmarket unit price for each collection card.
* Card details come from the 24h in-memory cache, so repeated cards and
* repeated page loads don't hit the TCGdex API again.
* repeated page loads don't hit the TCGdex API again. Cards without a
* Cardmarket price get 0 for consistent display (0,00 €).
*/
export async function priceCollectionCards(
cards: MyCard[],
@@ -36,8 +37,7 @@ export async function priceCollectionCards(
const priceKey = variantPriceMap[card.variant ?? ""] ?? "avg";
price = cardmarket[priceKey] ?? cardmarket.avg ?? 0;
}
const quantity = card.quantity ?? 1;
return { ...card, price, totalPrice: price * quantity };
return { ...card, price, totalPrice: price };
}),
);
}