From 1f4182f2f6c1de38416f8a7cfab213288de8739c Mon Sep 17 00:00:00 2001 From: olekkorob Date: Tue, 14 Mar 2023 10:36:46 +0200 Subject: [PATCH] fix: default date range issue --- web/src/components/LocationReportComponent.vue | 16 ++++++++-------- web/src/components/SituationReportComponent.vue | 9 +++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/web/src/components/LocationReportComponent.vue b/web/src/components/LocationReportComponent.vue index b875607c4..8677dcd45 100644 --- a/web/src/components/LocationReportComponent.vue +++ b/web/src/components/LocationReportComponent.vue @@ -1353,11 +1353,17 @@ export default { }, }, watch: { - '$route.query': function (newVal, oldVal) { - if (newVal.loc !== oldVal.loc) { + $route: function (newVal, oldVal) { + if (newVal.query.loc !== oldVal.query.loc) { + this.minDate = newVal.query.xmin; + this.maxDate = newVal.query.xmax; this.newLocation = null; this.createReport(); this.customMutations = this.grabCustomMutations(); + } else { + this.minDate = newVal.query.xmin; + this.maxDate = newVal.query.xmax; + this.createReport(); } }, recentWindow() { @@ -1760,9 +1766,6 @@ export default { this.maxDate = event.newMax; this.minDate = event.newMin; this.month = event.month; - this.setupReport(); - this.updateMaps(); - this.updateTable(); }, updateMapDateRange(month) { this.month = month; @@ -1788,9 +1791,6 @@ export default { selected: queryParams.selected, }, }); - this.setupReport(); - this.updateMaps(); - this.updateTable(); }, getDateRangeText() { if (this.xmin && this.xmax) { diff --git a/web/src/components/SituationReportComponent.vue b/web/src/components/SituationReportComponent.vue index 8ec1f464e..f6a782c87 100644 --- a/web/src/components/SituationReportComponent.vue +++ b/web/src/components/SituationReportComponent.vue @@ -1306,9 +1306,13 @@ export default { this.newPangolin = null; this.lineageName = null; this.reportMetadata = null; + this.minDate = newVal.query.xmin; + this.maxDate = newVal.query.xmax; this.setupReport(); } else { - this.updateLocations(); + this.minDate = newVal.query.xmin; + this.maxDate = newVal.query.xmax; + this.setupReport(); } }, }, @@ -1510,7 +1514,6 @@ export default { // sublineagePrev this.sublineagePrev = results.sublineagePrev; - // location prevalence this.locationTotals = results.locPrev; @@ -1836,8 +1839,6 @@ export default { updateDateRange(event) { this.maxDate = event.newMax; this.minDate = event.newMin; - this.setupReport(); - this.updateLocations(); }, }, };