changeset 4010:ccdfa66e33c3

available_fairway_depthLNWL: in case the resultset has no inbetween result, the bar chart should render correct
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 19 Jul 2019 12:08:15 +0200
parents aee74a3a17f3
children 44060b9027da
files client/src/store/fairwayavailability.js
diffstat 1 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/fairwayavailability.js	Fri Jul 19 11:53:06 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Fri Jul 19 12:08:15 2019 +0200
@@ -312,13 +312,25 @@
         data.shift(); // remove header line
         data = data.map(d => {
           let columns = d.split(",");
-          return {
-            date: columns[0],
-            ldc: Number(columns[2]),
-            below: Number(columns[3]),
-            between: Number(columns[4]),
-            above: Number(columns[5])
-          };
+          let result;
+          if (columns.length === 6) {
+            result = {
+              date: columns[0],
+              ldc: Number(columns[2]),
+              below: Number(columns[3]),
+              between: Number(columns[4]),
+              above: Number(columns[5])
+            };
+          } else {
+            result = {
+              date: columns[0],
+              ldc: Number(columns[2]),
+              below: Number(columns[3]),
+              between: null,
+              above: Number(columns[4])
+            };
+          }
+          return result;
         });
         commit("setFwLNWLData", data);
         return data;