mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13: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
@@ -2582,19 +2582,23 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom
|
||||
continue;
|
||||
}
|
||||
|
||||
// Detect reason column from header row keywords
|
||||
let reasonColIdx = -1;
|
||||
// Known reason column overrides (confirmed by user): FR=S(18), UK=J(9), DE=N(13)
|
||||
const REASON_COL_OVERRIDE: Record<string, number> = { FR: 18, UK: 9, DE: 13 };
|
||||
let reasonColIdx = REASON_COL_OVERRIDE[country] ?? -1;
|
||||
|
||||
// For countries without a hardcoded override, detect from header keywords
|
||||
if (reasonColIdx === -1) {
|
||||
for (let r = 0; r < Math.min(rows.length, 15); r++) {
|
||||
const idx = (rows[r] || []).findIndex((cell: any) => {
|
||||
const s = String(cell || '').toUpperCase();
|
||||
return s.includes('ISSUE') || s.includes('REASON') || s.includes('STATUS') ||
|
||||
return s.includes('ISSUE') || s.includes('REASON') ||
|
||||
s.includes('MOTIVO') || s.includes('CAUSA') || s.includes('ESTADO') ||
|
||||
s.includes('COMMENT') || s.includes('OBSERV') || s.includes('SITUAC') ||
|
||||
s.includes('LBB') || s.includes('PROBLEMA') || s.includes('NOTE') ||
|
||||
s.includes('JUSTIF') || s.includes('DETALL');
|
||||
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}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user