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