mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:45:23 +02:00
fix: include ad rows without ASINs to match total PPC spend (Sponsored Brands fix)
This commit is contained in:
@@ -485,7 +485,7 @@ export const processAdsCSV = (file: File): Promise<AdsRecord[]> => {
|
||||
const unitsRaw = getColumnValue(row, ['units', 'einheiten', 'unidades', 'units sold', 'total units', /\d+\s*day.*unit/i, /unit.*within.*\d+\s*day/i, /total\s+unit/i, /units?\s*sold/i, /^units?$/i, /unit/i, /einheit/i, /unidad/i]);
|
||||
const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /sale.*within.*\d+\s*day/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /(?<!cost of )sale/i, /umsatz/i, /ventas/i]);
|
||||
|
||||
if (!asin || !countryRaw || weekRaw === undefined || weekRaw === '') continue;
|
||||
if (!countryRaw || weekRaw === undefined || weekRaw === '') continue;
|
||||
|
||||
const weekMatch = String(weekRaw).match(/\d+/);
|
||||
const weekNum = weekMatch ? parseInt(weekMatch[0], 10) : NaN;
|
||||
@@ -498,7 +498,7 @@ export const processAdsCSV = (file: File): Promise<AdsRecord[]> => {
|
||||
country: mapCountryToMarketplace(String(countryRaw)),
|
||||
year: currentYear,
|
||||
week: weekNum,
|
||||
asin: String(asin).trim(),
|
||||
asin: asin ? String(asin).trim() : '',
|
||||
cost: parseCurrency(String(costRaw)),
|
||||
clicks: parseUnits(String(clicksRaw)),
|
||||
impressions: parseUnits(String(impressionsRaw)),
|
||||
@@ -566,7 +566,7 @@ export const processAdsExcel = async (fileOrBuffer: File | ArrayBuffer): Promise
|
||||
const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /sale.*within.*\d+\s*day/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /(?<!cost of )sale/i, /umsatz/i, /ventas/i]);
|
||||
|
||||
// Skip if missing essential data
|
||||
if (!asin || !countryRaw || weekRaw === undefined || weekRaw === '') continue;
|
||||
if (!countryRaw || weekRaw === undefined || weekRaw === '') continue;
|
||||
|
||||
const weekMatch = String(weekRaw).match(/\d+/);
|
||||
const weekNum = weekMatch ? parseInt(weekMatch[0], 10) : NaN;
|
||||
@@ -581,7 +581,7 @@ export const processAdsExcel = async (fileOrBuffer: File | ArrayBuffer): Promise
|
||||
country: mapCountryToMarketplace(String(countryRaw)),
|
||||
year,
|
||||
week: weekNum,
|
||||
asin: String(asin).trim(),
|
||||
asin: asin ? String(asin).trim() : '',
|
||||
cost: parseCurrency(String(costRaw)),
|
||||
clicks: parseUnits(String(clicksRaw)),
|
||||
impressions: parseUnits(String(impressionsRaw)),
|
||||
|
||||
Reference in New Issue
Block a user