changeset 2950:1775ffa65504

import_overview: fix time calculation
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 05 Apr 2019 14:23:19 +0200
parents 91539caae611
children 1ac58e024942
files client/src/components/importoverview/ImportOverview.vue
diffstat 1 files changed, 26 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue	Fri Apr 05 13:55:45 2019 +0200
+++ b/client/src/components/importoverview/ImportOverview.vue	Fri Apr 05 14:23:19 2019 +0200
@@ -191,32 +191,7 @@
       if (id) this.showSingleRessource(id);
     },
     selectedInterval() {
-      const now = new Date();
-      switch (this.selectedInterval) {
-        case this.$options.LAST_HOUR:
-          this.$store.commit("imports/setStartDate", startOfHour(now));
-          this.$store.commit("imports/setEndDate", now);
-          break;
-        case this.$options.TODAY:
-          this.$store.commit("imports/setStartDate", startOfDay(now));
-          this.$store.commit("imports/setEndDate", now);
-          break;
-        case this.$options.LAST_7_DAYS:
-          this.$store.commit(
-            "imports/setStartDate",
-            subDays(startOfDay(now), 7)
-          );
-          this.$store.commit("imports/setEndDate", now);
-          break;
-        case this.$options.LAST_30_DAYS:
-          this.$store.commit(
-            "imports/setStartDate",
-            subDays(startOfDay(now), 30)
-          );
-          this.$store.commit("imports/setEndDate", now);
-          break;
-      }
-      this.loadLogs();
+      this.loadUpdatedLogs();
     },
     imports() {
       if (this.imports.length == 0) {
@@ -312,9 +287,31 @@
       return this.imports;
     },
     loadUpdatedLogs() {
-      const [start, end] = this.determineInterval(new Date());
-      this.$store.commit("imports/setStartDate", start);
-      this.$store.commit("imports/setEndDate", end);
+      const now = new Date();
+      switch (this.selectedInterval) {
+        case this.$options.LAST_HOUR:
+          this.$store.commit("imports/setStartDate", startOfHour(now));
+          this.$store.commit("imports/setEndDate", now);
+          break;
+        case this.$options.TODAY:
+          this.$store.commit("imports/setStartDate", startOfDay(now));
+          this.$store.commit("imports/setEndDate", now);
+          break;
+        case this.$options.LAST_7_DAYS:
+          this.$store.commit(
+            "imports/setStartDate",
+            subDays(startOfDay(now), 7)
+          );
+          this.$store.commit("imports/setEndDate", now);
+          break;
+        case this.$options.LAST_30_DAYS:
+          this.$store.commit(
+            "imports/setStartDate",
+            subDays(startOfDay(now), 30)
+          );
+          this.$store.commit("imports/setEndDate", now);
+          break;
+      }
       this.loadLogs();
     },
     loadLogs() {