mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13:45:23 +02:00
fix(parser): align ad sales and units regexes to capture standard Amazon header 'Sales within X days'
This commit is contained in:
@@ -455,8 +455,8 @@ export const processAdsCSV = (file: File): Promise<AdsRecord[]> => {
|
||||
const ctrRaw = getColumnValue(row, ['ctr', 'click-through rate', 'click-through-rate', 'click through rate', /click.*through.*rate/i, /ctr/i]);
|
||||
const acosRaw = getColumnValue(row, ['acos', 'advertising cost of sales', 'aCOS', /cost.*of.*sales/i, /acos/i]);
|
||||
const conversionsRaw = getColumnValue(row, ['conversions', 'konversionen', 'orders', 'pedidos', 'total orders', /order/i, /conversion/i]);
|
||||
const unitsRaw = getColumnValue(row, ['units', 'einheiten', 'unidades', 'units sold', 'total units', /\d+\s*day.*unit/i, /total\s+unit/i, /units?\s*sold/i, /^units?$/i, /einheit/i, /unidad/i]);
|
||||
const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /umsatz/i, /ventas/i]);
|
||||
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;
|
||||
|
||||
@@ -534,8 +534,8 @@ export const processAdsExcel = async (fileOrBuffer: File | ArrayBuffer): Promise
|
||||
const ctrRaw = getColumnValue(row, ['ctr', 'click-through rate', 'click-through-rate', 'click through rate', /click.*through.*rate/i, /ctr/i]);
|
||||
const acosRaw = getColumnValue(row, ['acos', 'advertising cost of sales', 'aCOS', /cost.*of.*sales/i, /acos/i]);
|
||||
const conversionsRaw = getColumnValue(row, ['conversions', 'konversionen', 'orders', 'pedidos', 'total orders', /order/i, /conversion/i]);
|
||||
const unitsRaw = getColumnValue(row, ['units', 'einheiten', 'unidades', 'units sold', 'total units', /\d+\s*day.*unit/i, /total\s+unit/i, /units?\s*sold/i, /^units?$/i, /einheit/i, /unidad/i]);
|
||||
const salesRaw = getColumnValue(row, ['sales', 'umsatz', 'ventas', 'ad sales', 'total sales', 'sales (30d)', /\d+\s*day.*sale/i, /total\s+sale/i, /attributed.*sale/i, /ad\s+sale/i, /^sales$/i, /umsatz/i, /ventas/i]);
|
||||
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]);
|
||||
|
||||
// Skip if missing essential data
|
||||
if (!asin || !countryRaw || weekRaw === undefined || weekRaw === '') continue;
|
||||
|
||||
Reference in New Issue
Block a user