feat(mkt): filter sales and ads to 2025 only and show full product catalog

This commit is contained in:
Christian Vidal Wolf
2026-03-11 13:06:06 +01:00
parent 7240c9998c
commit 9c55d132dd
+7 -7
View File
@@ -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<string, number>();
const unitsMap = new Map<string, number>();
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<string, number>();
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(