From 46884cbbc91d74e1e99537efb4c19654b8853a2e Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 22 Jul 2026 00:56:58 +0200 Subject: [PATCH] fix(map): report selected theme scale honestly --- ...sprint186_map_first_geographic_explorer.py | 3 +- frontend/src/components/map/MapWorkspace.tsx | 43 +++++++------------ 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/backend/tests/test_sprint186_map_first_geographic_explorer.py b/backend/tests/test_sprint186_map_first_geographic_explorer.py index 077d391f..97f64db7 100644 --- a/backend/tests/test_sprint186_map_first_geographic_explorer.py +++ b/backend/tests/test_sprint186_map_first_geographic_explorer.py @@ -20,7 +20,8 @@ def test_map_first_explorer_is_the_default_product_flow() -> None: assert "

Inzichten

" in workspace assert "Teken rechthoek" in workspace assert "Volledig werkgebied" in workspace - assert "Alle relevante thema" in workspace + assert "Gekozen thema" in workspace + assert "Kies kleiner gebied" in workspace assert "Bron nog niet ingeladen" in workspace assert "useMapThemeSelectionInsights" in workspace assert "datasetsApi.selectVectorFeatures" in read("frontend/src/hooks/useMapThemeSelectionInsights.ts") diff --git a/frontend/src/components/map/MapWorkspace.tsx b/frontend/src/components/map/MapWorkspace.tsx index 8ae8bf4e..b34e05c9 100644 --- a/frontend/src/components/map/MapWorkspace.tsx +++ b/frontend/src/components/map/MapWorkspace.tsx @@ -1166,7 +1166,7 @@ export function MapWorkspace({ ) }) }, [coverage, mapSelectionBbox, mapSelectionScale, onDemandProductsForZones, themeDatasetMap]) - const unavailableSelectionThemeCount = Math.max(DATA_THEMES.length - selectionRelevantThemes.length, 0) + const activeThemeSupportsCurrentSelection = selectionRelevantThemes.some((theme) => theme.id === activeTheme.id) const activeOnDemandMapProduct = mapSelectionScale === 'overview' || themeDatasetMap[activeTheme.id] ? null : onDemandProductMap.get(activeTheme.id) ?? null @@ -1369,17 +1369,6 @@ export function MapWorkspace({ }), [themeInsights], ) - const readSelectionThemeCount = useMemo( - () => { - const relevantThemeIds = new Set(selectionRelevantThemes.map((theme) => theme.id)) - return new Set( - themeResults - .filter((result) => relevantThemeIds.has(result.theme.id)) - .map((result) => result.theme.id), - ).size - }, - [selectionRelevantThemes, themeResults], - ) const activeThemeInsight = themeResults.find((item) => item.theme.id === activeThemeId) const activeResultDataset = activeThemeInsight?.dataset ?? activeThemeDataset const activeSelectionResult = activeThemeInsight?.result @@ -1425,10 +1414,10 @@ export function MapWorkspace({ const heightKm = dimensions.heightMetres / 1000 if (mapSelectionScale === 'regional') { const partitionCount = splitSelectionBbox(mapSelectionBbox).length - return `Regionale analyse van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} × ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Geschikte detailbronnen worden automatisch over ${partitionCount} begrensde bronpartities verwerkt; 5 m-rasters worden alleen meegenomen wanneer het veilige pixelbudget volstaat.` + return `Regionale selectie van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} x ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Het gekozen thema kan over maximaal ${partitionCount} begrensde bronpartities worden verwerkt; teken een kleiner gebied wanneer een fijnmazige rasterbron buiten het veilige pixelbudget valt.` } if (mapSelectionScale === 'overview') { - return `Overzichtsanalyse van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} × ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Alleen landelijke en vooraf ingeladen bronnen die deze schaal betrouwbaar ondersteunen worden bevraagd. Teken maximaal 50 × 50 km voor regionale thema's of 20 × 20 km voor alle detailbronnen.` + return `Overzichtsselectie van ${widthKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} x ${heightKm.toLocaleString('nl-BE', { maximumFractionDigits: 1 })} km. Het gekozen detailthema wordt niet automatisch op deze schaal bevraagd. Teken maximaal 50 x 50 km voor regionale thema's en ongeveer 16 x 16 km voor 5 m-rasters.` } return null }, [mapSelectionBbox, mapSelectionScale]) @@ -2685,24 +2674,31 @@ export function MapWorkspace({
-

Alle relevante thema’s

- {readSelectionThemeCount} van {selectionRelevantThemes.length} uitgelezen +

Gekozen thema

+ {activeSelectionResult ? 'Uitgelezen' : 'Geen meting'}
- {selectionRelevantThemes.flatMap((theme) => { + {[activeTheme].flatMap((theme) => { const dataset = themeDatasetMap[theme.id] const items = themeResults.filter((result) => result.theme.id === theme.id) const rows = items.length > 0 ? items : [null] return rows.map((item, index) => { - const resultDataset = item?.dataset ?? dataset + const resultDataset = item?.dataset ?? (activeThemeSupportsCurrentSelection ? dataset : undefined) + const unavailableAtScale = !activeThemeSupportsCurrentSelection return (
@@ -2712,13 +2708,6 @@ export function MapWorkspace({ {selectionScaleNotice ? (

{selectionScaleNotice}

) : null} - {unavailableSelectionThemeCount > 0 ? ( -

- {mapSelectionScale === 'overview' - ? `${unavailableSelectionThemeCount} detailthema's zijn op deze overzichtsschaal bewust niet bevraagd.` - : `${unavailableSelectionThemeCount} thema's zijn voor deze zone niet van toepassing, niet operationeel gekoppeld of te fijnmazig voor deze selectieschaal.`} -

- ) : null}
)}