mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 14:05:24 +02:00
fix(buybox): hardcode reason column for FR/UK/DE, remove STATUS keyword
FR/UK/DE sheets have a 'Status' column that appears before 'Reason', causing the dynamic detector to pick the wrong column. Use confirmed indices: FR=col S(18), UK=col J(9), DE=col N(13). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
916c349126
commit
1fb9956a15
+16
-12
@@ -2582,18 +2582,22 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect reason column from header row keywords
|
// Known reason column overrides (confirmed by user): FR=S(18), UK=J(9), DE=N(13)
|
||||||
let reasonColIdx = -1;
|
const REASON_COL_OVERRIDE: Record<string, number> = { FR: 18, UK: 9, DE: 13 };
|
||||||
for (let r = 0; r < Math.min(rows.length, 15); r++) {
|
let reasonColIdx = REASON_COL_OVERRIDE[country] ?? -1;
|
||||||
const idx = (rows[r] || []).findIndex((cell: any) => {
|
|
||||||
const s = String(cell || '').toUpperCase();
|
// For countries without a hardcoded override, detect from header keywords
|
||||||
return s.includes('ISSUE') || s.includes('REASON') || s.includes('STATUS') ||
|
if (reasonColIdx === -1) {
|
||||||
s.includes('MOTIVO') || s.includes('CAUSA') || s.includes('ESTADO') ||
|
for (let r = 0; r < Math.min(rows.length, 15); r++) {
|
||||||
s.includes('COMMENT') || s.includes('OBSERV') || s.includes('SITUAC') ||
|
const idx = (rows[r] || []).findIndex((cell: any) => {
|
||||||
s.includes('LBB') || s.includes('PROBLEMA') || s.includes('NOTE') ||
|
const s = String(cell || '').toUpperCase();
|
||||||
s.includes('JUSTIF') || s.includes('DETALL');
|
return s.includes('ISSUE') || s.includes('REASON') ||
|
||||||
});
|
s.includes('MOTIVO') || s.includes('CAUSA') || s.includes('ESTADO') ||
|
||||||
if (idx !== -1) { reasonColIdx = idx; break; }
|
s.includes('COMMENT') || s.includes('OBSERV') || s.includes('SITUAC') ||
|
||||||
|
s.includes('LBB') || s.includes('PROBLEMA') || s.includes('JUSTIF') || s.includes('DETALL');
|
||||||
|
});
|
||||||
|
if (idx !== -1) { reasonColIdx = idx; break; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[BuyBox] Sheet "${sheetName}" → ${country}: asinCol=${asinColIdx} (${maxHits} ASINs found), reasonCol=${reasonColIdx}`);
|
console.log(`[BuyBox] Sheet "${sheetName}" → ${country}: asinCol=${asinColIdx} (${maxHits} ASINs found), reasonCol=${reasonColIdx}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user