From adac2e04bb7db6907c7f8c1c64b1c1783dfd5d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P=2E?= Date: Mon, 25 May 2026 14:57:06 +0200 Subject: [PATCH] Show correct building techs in search --- webgis/js/controllers/search_controller.js | 12 ++++++++---- webgis/js/gis.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/webgis/js/controllers/search_controller.js b/webgis/js/controllers/search_controller.js index be9a79c..a09724e 100644 --- a/webgis/js/controllers/search_controller.js +++ b/webgis/js/controllers/search_controller.js @@ -37,18 +37,22 @@ export default class extends Controller { const response = await fetch(`${GisState.apiUrl}/search?` + new URLSearchParams(body)); const results = await response.json(); - console.warn(body); - this.containerTarget.classList.remove('is-hidden'); this.#injectResults(results); if (results.length) { // Reset zoom level after successful search map.setZoom(INIT_ZOOM); this.#filterMap(results); + + console.debug(results); + // Should technique always be shown after a search? for (const key of Object.keys(techsMarkers)) { - if (techsMarkers[key].options.label === body.technique) - map.addLayer(techsMarkers[key]); + for (const record of results) { + // Adjust for non-site records!! + if (techsMarkers[key].options.site === record.label) + map.addLayer(techsMarkers[key]); + } } } } diff --git a/webgis/js/gis.js b/webgis/js/gis.js index 24e5d7d..b94f54b 100644 --- a/webgis/js/gis.js +++ b/webgis/js/gis.js @@ -140,6 +140,7 @@ GIS.buildingTechs = async function () { techs.addLayer(marker); const markerLabel = `${record.coordinates[0]} ${record.coordinates[1]}`; marker.options.data = record; + // Rename to include non-site relations?? marker.options.site = record.site?.label; GisState.markers.buildingTechs[markerLabel] = marker; }