From 777a01e41716c6b1e7d0a10028572cf4a52bb67a Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Thu, 12 Mar 2026 16:52:06 +0100 Subject: [PATCH] fix: use all-country ads for MKT tab to match Excel file total filteredAdsData applies PAN_EU default when no marketplace is selected, cutting UK/other spend and showing 118k instead of the full 151k. mktAdsData skips the PAN_EU restriction: no customer filter = all countries, still respects explicit customer/year/week selections. Co-Authored-By: Claude Sonnet 4.6 --- App.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/App.tsx b/App.tsx index ba2f112..4695390 100644 --- a/App.tsx +++ b/App.tsx @@ -529,6 +529,17 @@ const App: React.FC = () => { const filteredData = useMemo(() => filterData(rawData, deferredFilters, stockMap, vendorStockMap, top50Mode), [rawData, deferredFilters, stockMap, vendorStockMap, top50Mode]); const filteredAdsData = useMemo(() => filterAdsData(adsData, deferredFilters, globalAsinMetadata, stockMap, vendorStockMap, top50Mode), [adsData, deferredFilters, globalAsinMetadata, stockMap, vendorStockMap, top50Mode]); + + // MKT tab: ads without PAN_EU default restriction — includes all countries unless + // the user explicitly selects a marketplace filter + const mktAdsData = useMemo(() => adsData.filter(ad => { + const countryMatch = deferredFilters.customer.length === 0 + ? true + : deferredFilters.customer.some(c => c.toUpperCase() === ad.country.toUpperCase()); + const yearMatch = deferredFilters.year.length === 0 || deferredFilters.year.includes(ad.year.toString()); + const weekMatch = deferredFilters.week.length === 0 || deferredFilters.week.includes(`W${ad.week}`); + return countryMatch && yearMatch && weekMatch; + }), [adsData, deferredFilters.customer, deferredFilters.year, deferredFilters.week]); const aggregatedData = useMemo(() => aggregateData(filteredData), [filteredData]); // Calculate country-aware Top 50 Best Sellers for 2025 @@ -926,7 +937,7 @@ const App: React.FC = () => { }>
- +