This commit is contained in:
gpt-engineer-app[bot] 2025-11-25 23:18:23 +00:00
parent de5e45ef30
commit b79e094e1c

View File

@ -110,9 +110,10 @@ export async function parseCSV(file: File, contaBancariaId?: string): Promise<Tr
} }
function detectarColuna(colunas: string[], possibilidades: string[]): string | null { function detectarColuna(colunas: string[], possibilidades: string[]): string | null {
for (const coluna of colunas) { // Percorre primeiro as possibilidades (mais específicas), depois as colunas
const colunaLower = coluna.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, ''); for (const possibilidade of possibilidades) {
for (const possibilidade of possibilidades) { for (const coluna of colunas) {
const colunaLower = coluna.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '');
if (colunaLower.includes(possibilidade)) { if (colunaLower.includes(possibilidade)) {
return coluna; return coluna;
} }