mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 14:55:24 +02:00
fix: prevent CPNP_NO from being overridden by dynamic column detection
CPNP_NO must stay hardcoded at index 107. Removed it from COLUMN_PATTERNS and added guard to skip empty patterns in resolveColumnIndices. Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
co-authored by
claude-flow
parent
889e98b0ca
commit
1b4918a385
+3
-2
@@ -82,7 +82,7 @@ export const COLUMN_PATTERNS: Record<keyof typeof COLUMNS, string[]> = {
|
||||
ITEM_TO_LOGISTIC: ['item', 'logistic'],
|
||||
ANNA_CHECK: ['anna', 'check'],
|
||||
ANNA_NOTE: ['anna', 'note'],
|
||||
CPNP_NO: ['cpnp'],
|
||||
CPNP_NO: [],
|
||||
// Virtual/Extra columns stay hardcoded and are NOT auto-detected from headers
|
||||
// to prevent internal data from being shifted or overwritten by Excel column shifts.
|
||||
};
|
||||
@@ -92,7 +92,8 @@ export function resolveColumnIndices(headers: string[]): typeof COLUMNS {
|
||||
const h = headers.map(val => String(val || '').toLowerCase());
|
||||
|
||||
Object.entries(COLUMN_PATTERNS).forEach(([key, patterns]) => {
|
||||
const idx = h.findIndex(headerText =>
|
||||
if (patterns.length === 0) return;
|
||||
const idx = h.findIndex(headerText =>
|
||||
patterns.every(p => headerText.includes(p.toLowerCase()))
|
||||
);
|
||||
if (idx >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user