From ccf545d30cc3f1ba362f76a38690ea52524bdc22 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Mon, 24 Aug 2026 22:28:00 +1200 Subject: [PATCH] Remove dead exclude_from_bom clause from ElementQueryWidget's query builder ElementQueryWidget::queryStr() reads FROM element_nomenclature_view, and that view already excludes flagged elements in its own WHERE clause (see createElementNomenclatureView() in projectdatabase.cpp). This widget then added a second condition on top: "exclude_from_bom IS NULL OR exclude_from_bom != '1'" -- but nothing anywhere ever writes the literal string "1" to this key (the only writer stores "true"/"false"), so the clause was true for every row that could possibly reach this point and did nothing. Confirmed dead three separate ways while reviewing qelectrotech#765: reading the value only ever comes back "true" or "false" (never "1"), an exclude_from_bom="1" element still appeared in --export-bom output on a test fixture, and the surrounding filter_ construction shows this AND'd clause cannot change the query's result set regardless of what filter_ already holds. Confirmed it a fourth way once already, by initially misreading this same clause as evidence the feature was broken -- it was reading the WHERE without the FROM three lines above, which is exactly the trap being removed here for the next reader. ElementQueryWidget backs the BOM export dialog and the diagram table properties widget; neither has a headless CLI equivalent, so this could not be verified end-to-end through --export-bom the way the case-insensitivity fix could. Verified instead: the file compiles clean, and a load/resave/--export-bom smoke test on examples/tremie_vibrante.qet shows no change in app behaviour (98 components, matching the pre-change baseline -- expected, since --export-bom does not go through this widget at all). Co-Authored-By: Claude Sonnet 5 --- sources/dataBase/ui/elementquerywidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/dataBase/ui/elementquerywidget.cpp b/sources/dataBase/ui/elementquerywidget.cpp index b68036028..fff775b82 100644 --- a/sources/dataBase/ui/elementquerywidget.cpp +++ b/sources/dataBase/ui/elementquerywidget.cpp @@ -378,10 +378,10 @@ QString ElementQueryWidget::queryStr() const where.clear(); } - QString exclude_condition = "(exclude_from_bom IS NULL OR exclude_from_bom != '1')"; - - filter_ += " AND " + exclude_condition; - // ------------------------------------------------------------- + // exclude_from_bom is already filtered by element_nomenclature_view + // (see createElementNomenclatureView() in projectdatabase.cpp); this + // widget's query reads FROM that view, so a flagged element never + // reaches this point in the first place. if (where.isEmpty() && !filter_.isEmpty()) { filter_.remove(0, 4); //Remove the first " AND" of filter.