mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
Fix: correctly filter Dashboard revenue by enforcing Marketplace and Unit rules in filterData
This commit is contained in:
@@ -1155,7 +1155,13 @@ export const filterData = (
|
||||
}
|
||||
|
||||
// 2. Standard Filters
|
||||
return result.filter(item => { // Apply remaining filters to the 'result'
|
||||
return result.filter(item => {
|
||||
// 0. Core Business Rules (Revenue Integrity)
|
||||
// These filters ensure that only valid Amazon sales are aggregated,
|
||||
// excluding ad spend and marketing records that might be present in the raw source.
|
||||
if (!isAllowedCustomer(item.customer)) return false;
|
||||
if (item.units === 0) return false;
|
||||
|
||||
// 1. Month Logic: Handle "Apr-23" matching "Apr" filter
|
||||
const recordMonth = item.month; // e.g. "Apr-23"
|
||||
const pureMonth = recordMonth.split('-')[0]; // "Apr"
|
||||
|
||||
Reference in New Issue
Block a user