mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13:45:23 +02:00
fix: correct ad spend over-calculation in Weekly Grid
- Refactored mergeSalesAndAdsData to aggregate by ASIN+Customer+Year+Week - Each ASIN/Week now produces exactly one output record - Updated pivotWeeklySalesData to use ASIN as primary key - Fixed double-counting when same ASIN had multiple SKUs - Added support for ads-only records (ASINs with spend but no sales) - Changed App.tsx to use filtered ads data for accurate totals
This commit is contained in:
@@ -248,8 +248,8 @@ const App: React.FC = () => {
|
||||
|
||||
// Combine Sales & Ads Data dynamically based on current filters
|
||||
const combinedAdsData = useMemo(() => {
|
||||
return mergeSalesAndAdsData(filteredData, adsData);
|
||||
}, [filteredData, adsData]);
|
||||
return mergeSalesAndAdsData(filteredData, filteredAdsData);
|
||||
}, [filteredData, filteredAdsData]);
|
||||
|
||||
// Derive Context Data (Product Line Context when drilling down)
|
||||
const contextAggregatedData = useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user