fix: restore sales visibility by normalizing marketplace names in Sales pipeline

This commit is contained in:
Christian Vidal Wolf
2026-04-16 11:41:58 +02:00
parent 8c0401f3d5
commit adf72f6f96
+3 -1
View File
@@ -344,7 +344,8 @@ export const validateSellOutHeaders = (headers: string[]) => {
const mapRowToRecord = (row: any, index: number): SalesRecord => {
// Add exact matches to the front of getColumnValue arrays
const customer = getColumnValue(row, ['NEW CUSTOMER', 'COUNTRY', 'Customer', 'Client', 'Account', 'Partner', 'Country', 'Market']) || 'Unknown';
const rawCustomer = getColumnValue(row, ['NEW CUSTOMER', 'COUNTRY', 'Customer', 'Client', 'Account', 'Partner', 'Country', 'Market']) || 'Unknown';
const customer = mapCountryToMarketplace(rawCustomer);
const yearStr = getColumnValue(row, ['YEAR', 'Year', 'D']);
// Sanitize year string before parsing (remove commas/dots e.g. "2,023")
let year = parseInt(yearStr.replace(/[,.]/g, '')) || 0;
@@ -453,6 +454,7 @@ export const processExcel = async (file: File): Promise<SalesRecord[]> => {
const mapCountryToMarketplace = (country: string): string => {
const c = String(country).toLowerCase().trim();
if (c === 'pan-eu' || c === 'paneu') return 'Pan-EU';
if (c.includes('germany') || c.includes('deutschland') || c.includes('de')) return 'Amazon DE';
if (c.includes('spain') || c.includes('espana') || c.includes('españa') || c.includes('es')) return 'Amazon ES';
if (c.includes('france') || c.includes('fr')) return 'Amazon FR';