changeset 3579:571801483a70

search: display locationcode
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 03 Jun 2019 17:21:18 +0200
parents 5fb86c262756
children d38b20ccb6f9
files client/src/components/Search.vue pkg/controllers/search.go
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Search.vue	Mon Jun 03 17:15:37 2019 +0200
+++ b/client/src/components/Search.vue	Mon Jun 03 17:21:18 2019 +0200
@@ -70,7 +70,7 @@
             class="mr-1"
             fixed-width
           />
-          {{ entry.name }}
+          {{ entry.name }} {{ normalizeLocationCode(entry.locationcode) }}
         </a>
       </div>
     </div>
@@ -239,6 +239,10 @@
     }
   },
   methods: {
+    normalizeLocationCode(code) {
+      if (!code) return "";
+      return code.split(",").join("");
+    },
     loadLogs() {
       this.$store
         .dispatch("imports/getImports", {
--- a/pkg/controllers/search.go	Mon Jun 03 17:15:37 2019 +0200
+++ b/pkg/controllers/search.go	Mon Jun 03 17:21:18 2019 +0200
@@ -27,6 +27,7 @@
 const (
 	searchHectometreSQL = `SELECT COALESCE(json_agg(r),'[]')
 FROM (SELECT (location_code).hectometre || ' rhm' AS name,
+			concat(location_code) AS locationcode,
              ST_AsGeoJSON(geom)::json AS geom, 'rhm' AS type
       FROM waterway.distance_marks_virtual
       WHERE (location_code).hectometre = $1) r`