diff client/src/lib/mixins.js @ 4153:7c44af0b9370

client: Waterleveldiagram Since there is no convention for the nameing of reference waterlevels we have to do some guesswork. Levels containing /HDC/ are considered hdc and ldc accordingly are determined by /LDC/. For now, we assume having only a max of one LDC and one HDC. If there are multiple instances of LDC and HDC, LDCs are red and HDCs are green.
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 02 Aug 2019 12:59:23 +0200
parents 7959f62d3051
children 552ea22ed266
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Fri Aug 02 12:00:15 2019 +0200
+++ b/client/src/lib/mixins.js	Fri Aug 02 12:59:23 2019 +0200
@@ -47,6 +47,21 @@
     }
   }
 };
+/**
+ * Since the names of LDC and HDC aren't normalized, we have to do guesswork
+ * best fit is key with HDC or LDC in it
+ */
+export const refwaterlevels = {
+  methods: {
+    determineLDCHDC(refWaterLevels) {
+      let HDC =
+        refWaterLevels[Object.keys(refWaterLevels).find(e => /HDC/.test(e))];
+      let LDC =
+        refWaterLevels[Object.keys(refWaterLevels).find(e => /LDC/.test(e))];
+      return { LDC, HDC };
+    }
+  }
+};
 
 export const diagram = {
   methods: {