mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:55:22 +02:00
feat(mkt): filter sales and ads to 2025 only and show full product catalog
This commit is contained in:
@@ -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 sellOutMap = new Map<string, number>();
|
||||||
const unitsMap = 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();
|
const asin = r.asin.trim().toUpperCase();
|
||||||
sellOutMap.set(asin, (sellOutMap.get(asin) || 0) + r.sellOut);
|
sellOutMap.set(asin, (sellOutMap.get(asin) || 0) + r.sellOut);
|
||||||
unitsMap.set(asin, (unitsMap.get(asin) || 0) + r.units);
|
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>();
|
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();
|
const asin = r.asin.trim().toUpperCase();
|
||||||
adsSpendMap.set(asin, (adsSpendMap.get(asin) || 0) + r.cost);
|
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,
|
chargebacks: chargebacksMap.get(asin) || 0,
|
||||||
chargebacksPrevMonth: 0,
|
chargebacksPrevMonth: 0,
|
||||||
cogs: 0,
|
cogs: 0,
|
||||||
}))
|
}));
|
||||||
// Only show products that have actual sales
|
|
||||||
.filter(p => p.grossSales > 0);
|
|
||||||
}, [rawData, adsData, dealsMap, promosMap, chargebacksMap]);
|
}, [rawData, adsData, dealsMap, promosMap, chargebacksMap]);
|
||||||
|
|
||||||
const categories = useMemo(
|
const categories = useMemo(
|
||||||
|
|||||||
Reference in New Issue
Block a user