fix: convert string values to numbers in prize stats calculation
- Use Number() to ensure proper addition instead of string concatenation - Fix stockRemaining calculation for individual prize cards 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
13ee6b8831
commit
ea67bf4137
|
|
@ -94,8 +94,8 @@ export default function PrizeManagement() {
|
|||
|
||||
// Calculer les stats
|
||||
const prizeStats = useMemo(() => {
|
||||
const totalStock = prizes.reduce((acc, p) => acc + (p.initialStock || p.stock || 0), 0);
|
||||
const totalUsed = prizes.reduce((acc, p) => acc + (p.ticketsUsed || 0), 0);
|
||||
const totalStock = prizes.reduce((acc, p) => acc + Number(p.initialStock || p.stock || 0), 0);
|
||||
const totalUsed = prizes.reduce((acc, p) => acc + Number(p.ticketsUsed || 0), 0);
|
||||
const activeCount = prizes.filter(p => p.isActive).length;
|
||||
return { totalStock, totalUsed, activeCount, totalPrizes: prizes.length };
|
||||
}, [prizes]);
|
||||
|
|
@ -195,7 +195,7 @@ export default function PrizeManagement() {
|
|||
{prizes.map((prize) => {
|
||||
const style = getPrizeStyle(prize.type);
|
||||
const IconComponent = style.icon;
|
||||
const stockRemaining = (prize.initialStock || 0) - (prize.ticketsUsed || 0);
|
||||
const stockRemaining = Number(prize.initialStock || 0) - Number(prize.ticketsUsed || 0);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user