mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 11:45:23 +02:00
Fix: implement definitive revenue integrity filter with ASIN validation and strict marketplace whitelist
This commit is contained in:
@@ -5,7 +5,7 @@ import Dashboard from './components/Dashboard';
|
||||
import FilterBar from './components/FilterBar';
|
||||
import AIChat from './components/AIChat';
|
||||
import CrazeLogo from './components/CrazeLogo';
|
||||
import { processCSV, processExcel, filterData, aggregateData, processAdsCSV, processAdsExcel, mergeSalesAndAdsData, processTrafficExcel, processStockExcel, filterAdsData, calculateForecastViewData, processVendorStockExcel, processUKInventoryExcel, calculateVelocityMap, getUniqueValues, processForecastExcel, processBuyBoxExcel, processBSRExcel, filterBsrData } from './services/dataProcessor';
|
||||
import { processCSV, processExcel, filterData, aggregateData, processAdsCSV, processAdsExcel, mergeSalesAndAdsData, processTrafficExcel, processStockExcel, filterAdsData, calculateForecastViewData, processVendorStockExcel, processUKInventoryExcel, calculateVelocityMap, getUniqueValues, processForecastExcel, processBuyBoxExcel, processBSRExcel, filterBsrData, isAllowedCustomer, isRealSale } from './services/dataProcessor';
|
||||
import { SalesRecord, FilterState, AggregatedData, AdsRecord, TrafficRecord, ForecastRecord, ProductForecastData, ActiveExperiment, BSRRecord } from './types';
|
||||
import { queryGemini } from './services/geminiService';
|
||||
import { ChartIcon, TableIcon, CloseIcon, TrendingIcon, MegaphoneIcon } from './components/Icons';
|
||||
@@ -537,18 +537,11 @@ const App: React.FC = () => {
|
||||
const filteredData = useMemo(() => {
|
||||
const baseFiltered = filterData(rawData, deferredFilters, stockMap, vendorStockMap, top50Mode);
|
||||
|
||||
// Safety check: Final redundancy to ensure marketing/ad spend records never reach the dashboard cards.
|
||||
// This is a "double-lock" to prevent revenue inflation even if the service layer fails to update.
|
||||
// DEFINITIVE REVENUE FILTER (BRUTE FORCE):
|
||||
// This is the absolute final safeguard against revenue inflation.
|
||||
// It enforces the strict isRealSale and isAllowedCustomer rules at the UI layer.
|
||||
return baseFiltered.filter(r => {
|
||||
if (r.units === 0) return false;
|
||||
|
||||
// Marketplace check
|
||||
const normC = r.customer?.trim().toLowerCase();
|
||||
const isAmazon = normC.startsWith('amazon') || normC === 'pan-eu';
|
||||
const isOnlyCountry = ['uk', 'de', 'it', 'fr', 'es', 'nl', 'se', 'pl', 'be'].includes(normC);
|
||||
|
||||
if (isOnlyCountry && !normC.startsWith('amazon')) return false;
|
||||
return isAmazon;
|
||||
return isAllowedCustomer(r.customer) && isRealSale(r);
|
||||
});
|
||||
}, [rawData, deferredFilters, stockMap, vendorStockMap, top50Mode]);
|
||||
console.timeEnd('filteredData');
|
||||
|
||||
Reference in New Issue
Block a user