From 85451a6b3187223c062244f7d6b708f6d3fd9c77 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Wed, 8 Apr 2026 19:27:29 +0200 Subject: [PATCH] fix: add parentheses for correct boolean operator precedence in column filter The missing/present filter was not working due to operator precedence. Added explicit parentheses to ensure correct evaluation. Co-authored-by: Qwen-Coder --- src/components/ProductDescriptions.tsx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/components/ProductDescriptions.tsx b/src/components/ProductDescriptions.tsx index 14872be..b5f8685 100644 --- a/src/components/ProductDescriptions.tsx +++ b/src/components/ProductDescriptions.tsx @@ -7,6 +7,7 @@ import { ColumnFilterPopover } from './ColumnFilterPopover'; interface ProductDescriptionsProps { data: ExcelRow[]; onEdit: (index: number) => void; + rowStatuses: Record; } type TabType = 'all' | 'missingLongDE' | 'missingLongEN' | 'missingLongAny' | 'missingShortDE' | 'missingShortEN' | 'missingShortAny' | 'complete' | 'incomplete'; @@ -14,7 +15,7 @@ type TabType = 'all' | 'missingLongDE' | 'missingLongEN' | 'missingLongAny' | 'm // Description columns that should only have Present/Missing filters const DESCRIPTION_COLUMNS = [COLUMNS.LONG_DE, COLUMNS.LONG_EN, COLUMNS.SHORT_DE, COLUMNS.SHORT_EN]; -export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps) { +export function ProductDescriptions({ data, onEdit, rowStatuses }: ProductDescriptionsProps) { const [activeTab, setActiveTab] = useState('all'); const [search, setSearch] = useState(''); const [lineFilter, setLineFilter] = useState(''); @@ -71,7 +72,7 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps) if (DESCRIPTION_COLUMNS.includes(col)) { result = result.filter(r => { const hasValue = Boolean(r.row[col]); - const shouldInclude = vals.includes('Present') && hasValue || vals.includes('Missing') && !hasValue; + const shouldInclude = (vals.includes('Present') && hasValue) || (vals.includes('Missing') && !hasValue); return shouldInclude; }); } else { @@ -304,8 +305,17 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps) - {paginatedData.map(({ row, index }) => ( - + {paginatedData.map(({ row, index }) => { + const isPending = rowStatuses[String(row[COLUMNS.ARTICLE_NO])] === 'pending'; + return ( + {row[COLUMNS.ARTICLE_NO]} {row[COLUMNS.ARTICLE_NAME]} {row[COLUMNS.LINE]} @@ -334,7 +344,8 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps) - ))} + ); + })} {paginatedData.length === 0 && (