changeset 3258:276fde700aa6

client: import stretches: shortened code a bit
author Markus Kottlaender <markus@intevation.de>
date Tue, 14 May 2019 19:00:57 +0200
parents 97bd458acf0e
children 985bc5009115
files client/src/components/ImportStretches.vue
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/ImportStretches.vue	Tue May 14 18:57:12 2019 +0200
+++ b/client/src/components/ImportStretches.vue	Tue May 14 19:00:57 2019 +0200
@@ -366,14 +366,13 @@
   },
   watch: {
     identifiedFeatures() {
-      const filterDistanceMarks = x => {
-        return /^distance_marks_geoserver/.test(x["id_"]);
-      };
-      const distanceMark = this.identifiedFeatures.filter(filterDistanceMarks);
-      if (distanceMark.length > 0) {
-        const value = distanceMark[0].getProperties()["location"];
-        this.startrhm = this.pipetteStart ? value : this.startrhm;
-        this.endrhm = this.pipetteEnd ? value : this.endrhm;
+      const distanceMark = this.identifiedFeatures.find(x =>
+        /^distance_marks_geoserver/.test(x["id_"])
+      );
+      if (distanceMark) {
+        const location = distanceMark.get("location");
+        this.startrhm = this.pipetteStart ? location : this.startrhm;
+        this.endrhm = this.pipetteEnd ? location : this.endrhm;
         this.pipetteStart = false;
         this.pipetteEnd = false;
       }