changeset 3451:8634d2bd0aac

afd
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 24 May 2019 13:07:02 +0200
parents 213b703bdd85
children ae6c09fbc590
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 52 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Fri May 24 12:51:12 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Fri May 24 13:07:02 2019 +0200
@@ -139,6 +139,54 @@
   });
 };
 
+/**
+ * transformAFDLNWL
+ * @param {*} csv
+ *
+ * takes the afd csv and transforms it to an intermediary format
+ * for display of diagrams
+ *
+ * Incoming csv Format
+ * #time,#LDC < 162.000 [%],#LDC >= 162.000 [%],#d < 230.000 [%],#d >= 230.000 [%],#d >= 250.000 [%]
+ * 05-2018,0.000,0.000,0.000,0.000,16.163
+ * 06-2018,0.000,0.000,0.000,0.000,16.701
+ * 07-2018,0.000,0.000,0.000,0.000,16.163
+ * 08-2018,0.000,0.000,0.000,0.000,16.163
+ * 09-2018,0.000,0.000,0.000,0.000,16.701
+ * 10-2018,0.000,0.000,0.000,0.000,16.163
+ * 11-2018,0.000,0.000,0.000,0.000,16.701
+ * 12-2018,0.000,0.000,0.000,0.000,16.163
+ * 01-2019,0.000,0.000,0.000,0.000,16.163
+ * 02-2019,0.000,0.000,0.000,0.000,17.894
+ * 03-2019,0.000,0.000,0.000,0.000,16.163
+ * 04-2019,0.000,0.000,0.000,0.000,16.701
+ * 05-2019,0.000,16.163,0.000,0.000,16.163
+ */
+// CURRENTLY UNUSED
+// const transformAFDLNWL = csv => {
+//   return csv.map(e => {
+//     const result = e.split(",");
+//     let [label, lowldc, ldc, lower, middle, highestLevel] = result;
+//     let levelsWithSum = [
+//       {
+//         height: Number(lower),
+//         translateY: 0
+//       },
+//       {
+//         height: Number(middle),
+//         translateY: Number(lower)
+//       }
+//     ];
+//     return {
+//       label: label,
+//       ldc: ldc,
+//       lowldc: lowldc,
+//       highestLevel: highestLevel,
+//       lowerLevels: levelsWithSum
+//     };
+//   });
+// };
+
 const fairwayavailability = {
   init,
   namespaced: true,
@@ -267,7 +315,7 @@
           });
       });
     },
-    loadAvailableFairwayDepthLNWL: ({ commit }, options) => {
+    loadAvailableFairwayDepthLNWL: (context, options) => {
       return new Promise((resolve, reject) => {
         const { feature, frequency, LOS } = options;
         let { from, to } = options;
@@ -286,7 +334,6 @@
         })
           .then(response => {
             const { data } = response;
-            commit("setCSV", data);
             resolve(data);
           })
           .catch(error => {
@@ -295,7 +342,8 @@
       });
     },
     loadAvailableFairwayDepthLNWLDiagram: ({ commit, dispatch }, options) => {
-      dispatch("loadAvailableFairwayDepthLNWL", options).then(() => {
+      dispatch("loadAvailableFairwayDepthLNWL", options).then(response => {
+        commit("setCSV", response);
         //const data = response;
         let data = LNWLDIAGRAMMOCKDATA;
         data["lnwl"] = data["lnwl"].filter(v => v.level !== "HDC");
@@ -308,6 +356,7 @@
             return elem;
           });
         });
+        // transformAFDLNWL
         commit("setFwLNWLData", data);
       });
     }