mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 16:45:24 +02:00
fix: restore sales visibility by normalizing marketplace names in Sales pipeline
This commit is contained in:
@@ -344,7 +344,8 @@ export const validateSellOutHeaders = (headers: string[]) => {
|
|||||||
|
|
||||||
const mapRowToRecord = (row: any, index: number): SalesRecord => {
|
const mapRowToRecord = (row: any, index: number): SalesRecord => {
|
||||||
// Add exact matches to the front of getColumnValue arrays
|
// 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']);
|
const yearStr = getColumnValue(row, ['YEAR', 'Year', 'D']);
|
||||||
// Sanitize year string before parsing (remove commas/dots e.g. "2,023")
|
// Sanitize year string before parsing (remove commas/dots e.g. "2,023")
|
||||||
let year = parseInt(yearStr.replace(/[,.]/g, '')) || 0;
|
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 mapCountryToMarketplace = (country: string): string => {
|
||||||
const c = String(country).toLowerCase().trim();
|
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('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('spain') || c.includes('espana') || c.includes('españa') || c.includes('es')) return 'Amazon ES';
|
||||||
if (c.includes('france') || c.includes('fr')) return 'Amazon FR';
|
if (c.includes('france') || c.includes('fr')) return 'Amazon FR';
|
||||||
|
|||||||
Reference in New Issue
Block a user