diff --git a/components/mkt/MktDataView.tsx b/components/mkt/MktDataView.tsx index bea4590..9686449 100644 --- a/components/mkt/MktDataView.tsx +++ b/components/mkt/MktDataView.tsx @@ -160,18 +160,20 @@ export default function MktDataView({ rawData, adsData }: MktDataViewProps) { } }); - // ASIN → global sell-out and units (all marketplaces summed) + // ASIN → global sell-out and units (only for 2025) const sellOutMap = new Map(); const unitsMap = new Map(); - rawData.forEach(r => { + const rawData2025 = rawData.filter(r => r.year === 2025); + rawData2025.forEach(r => { const asin = r.asin.trim().toUpperCase(); sellOutMap.set(asin, (sellOutMap.get(asin) || 0) + r.sellOut); unitsMap.set(asin, (unitsMap.get(asin) || 0) + r.units); }); - // ASIN → global ad spend (all marketplaces summed) + // ASIN → global ad spend (only for 2025) const adsSpendMap = new Map(); - adsData.forEach(r => { + const adsData2025 = adsData.filter(r => r.year === 2025); + adsData2025.forEach(r => { const asin = r.asin.trim().toUpperCase(); adsSpendMap.set(asin, (adsSpendMap.get(asin) || 0) + r.cost); }); @@ -193,9 +195,7 @@ export default function MktDataView({ rawData, adsData }: MktDataViewProps) { chargebacks: chargebacksMap.get(asin) || 0, chargebacksPrevMonth: 0, cogs: 0, - })) - // Only show products that have actual sales - .filter(p => p.grossSales > 0); + })); }, [rawData, adsData, dealsMap, promosMap, chargebacksMap]); const categories = useMemo(