mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 14:45:24 +02:00
feat: Make Buy Box sheet matching even more aggressive
This commit is contained in:
@@ -2164,11 +2164,12 @@ export const processBuyBoxExcel = async (fileOrBuffer: File | ArrayBuffer): Prom
|
|||||||
console.log('[BuyBox] Available sheets:', workbook.SheetNames.join(', '));
|
console.log('[BuyBox] Available sheets:', workbook.SheetNames.join(', '));
|
||||||
|
|
||||||
for (const config of BB_SHEET_CONFIG) {
|
for (const config of BB_SHEET_CONFIG) {
|
||||||
// Find sheet case-insensitively and with flexible separators (BB_ES, BB-ES, BB ES)
|
// Find sheet case-insensitively and with flexible separators (BB_ES, BB-ES, BB ES, ES BB)
|
||||||
const sheetName = workbook.SheetNames.find(name => {
|
const sheetName = workbook.SheetNames.find(name => {
|
||||||
const n = name.toUpperCase().replace(/[-_ ]/g, '');
|
const n = name.toUpperCase().replace(/[-_ ]/g, '');
|
||||||
const target = config.sheet.toUpperCase().replace(/[-_ ]/g, '');
|
const target = config.sheet.toUpperCase().replace(/[-_ ]/g, '');
|
||||||
return n === target;
|
// Also match if the sheet is just the country code or contains 'BB' and the country code
|
||||||
|
return n === target || n === config.country || (n.includes('BB') && n.includes(config.country));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!sheetName) {
|
if (!sheetName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user