mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:15:23 +02:00
fix: correct revenue metric mapping in Weekly Sales grid (pivot revenue vs ads cost)
This commit is contained in:
@@ -1642,7 +1642,8 @@ export interface WeeklyPivotRow {
|
||||
line: string;
|
||||
customer: string;
|
||||
unitsByWeek: { [weekKey: string]: number }; // Key: "YYYY-WW"
|
||||
spendByWeek: { [weekKey: string]: number }; // Key: "YYYY-WW"
|
||||
spendByWeek: { [weekKey: string]: number }; // Key: "YYYY-WW" (Ads Cost)
|
||||
revenueByWeek: { [weekKey: string]: number }; // Key: "YYYY-WW" (Sell-out)
|
||||
gvByWeek: { [weekKey: string]: number }; // Key: "YYYY-WW"
|
||||
}
|
||||
|
||||
@@ -1691,6 +1692,7 @@ export const pivotWeeklySalesData = (data: CombinedKPIs[]): {
|
||||
customer: record.customer || record.marketplace || '',
|
||||
unitsByWeek: {},
|
||||
spendByWeek: {},
|
||||
revenueByWeek: {},
|
||||
gvByWeek: {}
|
||||
};
|
||||
map.set(key, row);
|
||||
@@ -1698,6 +1700,7 @@ export const pivotWeeklySalesData = (data: CombinedKPIs[]): {
|
||||
|
||||
row.unitsByWeek[weekKey] = (row.unitsByWeek[weekKey] || 0) + (record.unitsTotal || 0);
|
||||
row.spendByWeek[weekKey] = (row.spendByWeek[weekKey] || 0) + (record.cost || 0);
|
||||
row.revenueByWeek[weekKey] = (row.revenueByWeek[weekKey] || 0) + (record.salesTotal || 0);
|
||||
row.gvByWeek[weekKey] = (row.gvByWeek[weekKey] || 0) + (record.glanceViews || 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user