small bugfix

This commit is contained in:
Timo Volkmann 2019-05-10 11:30:39 +02:00
parent 8857f886d9
commit 235f3fd0b5

View File

@ -105,8 +105,6 @@
return {
tab: 'startedCaches',
startedCaches: [],
//progress: 0.4
}
},
mounted: function () {
@ -118,30 +116,21 @@
},
created: function () {
this.$store.commit('auth/SET_AUTHENTICATED');
//this.$store.commit('auth/SET_USER');
this.fetchUserCaches();
},
methods: {
calculateProgress() {
console.log("calcProgress...")
console.log("this.startedCaches: ")
console.log(this.startedCaches)
// for (let startedCache of this.startedCaches) {
// console.log(startedCache)
// let stationCount = startedCache.cache.stationen.length;
// let stationPos = 1 + startedCache.cache.stationen.findIndex(station => station.id === startedCache.aktuelleStation.id);
// startedCache.progress = stationPos / stationCount;
// console.log(startedCache.progress)
// }
this.startedCaches.forEach(startedCache => {
console.log(startedCache)
let stationCount = startedCache.cache.stationen.length;
let stationPos = 1 + startedCache.cache.stationen.findIndex(station => station.id === startedCache.aktuelleStation.id);
startedCache.progress = stationPos / stationCount;
console.log(startedCache.progress)
})
console.log("calcProgress finished.")
console.log("progress: "+startedCache.progress)
});
console.log("calcProgress finished.");
console.log(this.startedCaches)
},
fetchUserCaches() {
@ -156,7 +145,7 @@
.then((response) => {
console.log(response.data)
this.startedCaches = response.data;
this.calculateProgress();
}).catch((error) => {
// Error
let msg;
@ -180,9 +169,7 @@
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
}).finally(() => {
console.log("fetchCaches... finally")
this.calculateProgress();
});
console.log("fetchCaches... outside")
},
continueCache(cacheID) {
console.log("cacheID");