fix: restore CPNP No. from Supabase and simplify column filter matching in Cosmetic Items

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
Christian Vidal Wolf
2026-05-12 12:15:27 +02:00
co-authored by claude-flow
parent 60224931bc
commit 889e98b0ca
2 changed files with 3 additions and 6 deletions
+1 -1
View File
@@ -233,7 +233,7 @@ const articleNoIdx = resolvedCols.ARTICLE_NO;
// Merge logic: Prioritize internal control columns from syncedData or historyData // Merge logic: Prioritize internal control columns from syncedData or historyData
// Use synced.data only if it has internal cols (>= 100), otherwise use hist // Use synced.data only if it has internal cols (>= 100), otherwise use hist
const syncedHasInternalCols = synced?.data && Object.values(COLUMNS).some(idx => idx >= 100 && synced.data[idx] !== undefined && synced.data[idx] !== null); const syncedHasInternalCols = synced?.data && (synced.data.length > 100 || Object.values(COLUMNS).some(idx => idx >= 100 && synced.data[idx] !== undefined && synced.data[idx] !== null));
const sourceForInternal = syncedHasInternalCols ? synced!.data : (hist || synced?.data); const sourceForInternal = syncedHasInternalCols ? synced!.data : (hist || synced?.data);
if (sourceForInternal) { if (sourceForInternal) {
+2 -5
View File
@@ -82,13 +82,10 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro
(Object.entries(columnFilters) as [string, string[]][]).forEach(([colIdx, filterValues]) => { (Object.entries(columnFilters) as [string, string[]][]).forEach(([colIdx, filterValues]) => {
if (!filterValues || filterValues.length === 0) return; if (!filterValues || filterValues.length === 0) return;
const colNum = parseInt(colIdx); const colNum = parseInt(colIdx);
const allVals = getUniqueValues(colNum); const filterSet = new Set(filterValues.map(f => f.trim()));
// If all known values selected, no filtering needed
const filterSet = new Set(filterValues);
if (filterSet.size >= allVals.length && allVals.every(v => filterSet.has(v))) return;
result = result.filter(({ row }) => { result = result.filter(({ row }) => {
const val = String(row[colNum] ?? '').trim(); const val = String(row[colNum] ?? '').trim();
return filterValues.some(f => f.trim() === val); return filterSet.has(val);
}); });
}); });