From 2f37c1d6bfbf4b6b33958a1435d9a959fb75ea50 Mon Sep 17 00:00:00 2001 From: Tim Purdum Date: Mon, 29 Jun 2026 11:59:52 -0500 Subject: [PATCH] Filter Iowa bridges by deck condition only, matching the renderer The condition checkboxes built a definition expression that matched a bridge if ANY of DECK_COND_058, SUPERSTRUCTURE_COND_059, or SUBSTRUCTURE_COND_060 fell in the selected range. But the map's UniqueValueRenderer colors each dot solely by DECK_COND_058, so a bridge could keep a "Good"-colored dot while qualifying through a poor superstructure/substructure rating, making dots persist after the user unchecked the box for their visible color. Filter on the same field the renderer symbolizes by so the dots that disappear always match the unchecked boxes. Also drops the stale comment referencing an "Arcade renderer" (the renderer classifies by DECK_COND_058 directly). Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01Ejz9vZZjusM5qtxqzXyDSk --- .../Components/Bridges/BridgeFilterState.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/projects/IowaBridges/IowaBridges/Components/Bridges/BridgeFilterState.cs b/projects/IowaBridges/IowaBridges/Components/Bridges/BridgeFilterState.cs index f68ff32..2f0c8ea 100644 --- a/projects/IowaBridges/IowaBridges/Components/Bridges/BridgeFilterState.cs +++ b/projects/IowaBridges/IowaBridges/Components/Bridges/BridgeFilterState.cs @@ -60,13 +60,10 @@ public string ToDefinitionExpression() return null; } - // Build allowed code list from condition fields. Composite condition = min of the three, - // where 'N' means "not applicable" (commonly culverts) — we treat as 99/unknown and skip. - // The Arcade renderer maps: - // 0-4 -> Poor, 5-6 -> Fair, 7-9 -> Good - // For server-side filtering, mirror that by requiring at least one of the three condition - // fields to fall in the matching code set. (Approximate but readable; exact min requires - // server Arcade which the NBI service does not support.) + // Filter on the SAME field the renderer symbolizes by (DECK_COND_058) so the + // visible dot colors always match the checked condition boxes. The renderer maps: + // 0-4 -> Poor (red), 5-6 -> Fair (yellow), 7-9 -> Good (green) + // Filtering on deck condition alone keeps symbology and filtering consistent. var allowed = new List(); if (ShowPoor) allowed.AddRange(new[] { "0", "1", "2", "3", "4" }); @@ -74,9 +71,6 @@ public string ToDefinitionExpression() if (ShowGood) allowed.AddRange(new[] { "7", "8", "9" }); var quoted = string.Join(",", allowed.Select(c => $"'{c}'")); - return - $"DECK_COND_058 IN ({quoted}) OR " + - $"SUPERSTRUCTURE_COND_059 IN ({quoted}) OR " + - $"SUBSTRUCTURE_COND_060 IN ({quoted})"; + return $"DECK_COND_058 IN ({quoted})"; } }