changeset 3584:7b15a6dd4ae5

search: replace commata via SQL
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 04 Jun 2019 09:50:24 +0200
parents 391afcc961a2
children 479da494bc09
files client/src/components/Search.vue pkg/controllers/search.go
diffstat 2 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Search.vue	Mon Jun 03 18:37:12 2019 +0200
+++ b/client/src/components/Search.vue	Tue Jun 04 09:50:24 2019 +0200
@@ -70,7 +70,7 @@
             class="mr-1"
             fixed-width
           />
-          {{ entry.name }} {{ normalizeLocationCode(entry.locationcode) }}
+          {{ entry.name }} {{ entry.locationcode }}
         </a>
       </div>
     </div>
@@ -239,10 +239,6 @@
     }
   },
   methods: {
-    normalizeLocationCode(code) {
-      if (!code) return "";
-      return code.split(",").join("");
-    },
     loadLogs() {
       this.$store
         .dispatch("imports/getImports", {
--- a/pkg/controllers/search.go	Mon Jun 03 18:37:12 2019 +0200
+++ b/pkg/controllers/search.go	Tue Jun 04 09:50:24 2019 +0200
@@ -27,7 +27,7 @@
 const (
 	searchHectometreSQL = `SELECT COALESCE(json_agg(r),'[]')
 FROM (SELECT (location_code).hectometre || ' rhm' AS name,
-			concat(location_code) AS locationcode,
+			replace(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`