changeset 3042:762b140e91a0

client: gauges: if interval is only one year display only that one year
author Markus Kottlaender <markus@intevation.de>
date Sat, 13 Apr 2019 15:13:36 +0200
parents ccda334eed92
children de75404cb5fc
files client/src/store/gauges.js
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/store/gauges.js	Sat Apr 13 14:51:56 2019 +0200
+++ b/client/src/store/gauges.js	Sat Apr 13 15:13:36 2019 +0200
@@ -161,14 +161,13 @@
             const now = new Date();
             let data = response.data.split("\n");
             // get result interval from first line
-            commit(
-              "longtermInterval",
-              data[0]
-                .split(",")[0]
-                .split(" ")[1]
-                .split("-")
-                .map(y => Number(y))
-            );
+            let interval = data[0]
+              .split(",")[0]
+              .split(" ")[1]
+              .split("-")
+              .map(y => Number(y));
+            if (interval[0] === interval[1]) interval = [interval[0]];
+            commit("longtermInterval", interval);
             data = data
               // remove empty rows and rows starting with #
               .filter(wl => wl && wl[0] !== "#")