Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
- Don't double-load visits query
Browse files Browse the repository at this point in the history
  • Loading branch information
hardiesoft committed Jul 20, 2021
1 parent 64815d2 commit c355fde
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/components/Devices/DeviceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<MonitoringTab
:group-name="groupName"
:device-name="deviceName"
:visits-query="visitsQuery()"
:visits-query="staticVisitsQuery"
/>
</b-tab>
<!-- <b-tab title="Schedule">-->
Expand Down Expand Up @@ -137,6 +137,9 @@ export default {
await Promise.all([this.fetchRecordingCount(), this.fetchVisitsCount()]);
},
computed: {
staticVisitsQuery() {
return this.visitsQuery();
},
groupName() {
return this.$route.params.groupName;
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/MonitoringTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ export default {
};
},
async mounted() {
while (extraVisits.length) {
extraVisits.pop();
}
while (currentVisits.length) {
currentVisits.pop();
}
await this.fetchVisits();
},
methods: {
Expand Down Expand Up @@ -267,7 +273,6 @@ export default {
new Date(oldestVisit.timeStart)
);
// Now request again until we get a day that is less than oldestVisitDay. Split the remaining array into before and after.
//debugger;
while (
extraVisits.length === 0 &&
this.currentPage <= this.totalVisitsPages
Expand Down
1 change: 0 additions & 1 deletion src/components/VisitsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default {
// Slice from last recordings count, so we're only processing new recordings.
const newVisits = visits.slice(this.loadedVisitsCount);
const items = [];
// TODO(jon): Intersperse power-on/power-off events and dusk/dawn times
if (newVisits.length && this.loadedVisitsCount !== 0) {
items.push({
Expand Down

0 comments on commit c355fde

Please sign in to comment.