diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index c0f8b50..5fc390f 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -72,9 +72,7 @@ module.exports = function (ctx) { 'QPopupEdit', 'QSlideTransition', 'QToggle', - 'QStepper', - 'QStep', - 'QStepperNavigation' + 'QLinearProgress' ], directives: [ diff --git a/frontend/src/pages/MyCaches.vue b/frontend/src/pages/MyCaches.vue index ff7022f..1dab5cd 100644 --- a/frontend/src/pages/MyCaches.vue +++ b/frontend/src/pages/MyCaches.vue @@ -32,23 +32,21 @@ expand-separator icon="location_on" :label="startedCache.cache.name" - :caption=" startedCache.cache.description" + :caption="startedCache.cache.rankingPoints+' Punkte, '+startedCache.cache.stationen.length+' Stationen'" > - - - - - {{'Nächste Aufgabe: ' + startedCache.aktuelleStation.description }} - - {{'Ranglistenpunkte für diesen Cache: ' + startedCache.cache.rankingPoints}} + + + + + + {{ startedCache.progress * 100 }}% bereits geschafft - - - - + @@ -58,7 +56,9 @@ - + - @@ -104,11 +105,8 @@ return { tab: 'startedCaches', startedCaches: [], - inviteMail: "", - currentTeamStatus: "Dienstag 15:00 Treffen zum Blumencache", - teamStatus: "", - userName: null, - email: null, + + //progress: 0.4 } }, mounted: function () { @@ -119,12 +117,35 @@ }, }, created: function () { - this.fetchUserCaches(); this.$store.commit('auth/SET_AUTHENTICATED'); - this.$store.commit('auth/SET_USER'); + //this.$store.commit('auth/SET_USER'); + this.fetchUserCaches(); + }, methods: { - fetchUserCaches: function () { + 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(this.startedCaches) + }, + fetchUserCaches() { + console.log("fetchCaches...") let token; if (localStorage.getItem('userToken')) { token = JSON.parse(localStorage.getItem('userToken')).token; @@ -135,6 +156,7 @@ .then((response) => { console.log(response.data) this.startedCaches = response.data; + }).catch((error) => { // Error let msg; @@ -156,7 +178,11 @@ } console.log(error.config); 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"); @@ -192,73 +218,6 @@ }); } }, - getPersonalRanking() { - const name = JSON.parse(localStorage.getItem('userToken')).name; - console.log(JSON.parse(localStorage.getItem('userToken')).name); - this.$axios.get('/api/hello', {params: {name}}) - .then((response) => { - this.userRanking = response.data; - console.log(response.data); - }).catch((error) => { - // Error - let msg; - let title; - if (error.response) { - // The request was made and the server responded with a status code - title = "Problem with response!"; - msg = error.response; - } else if (error.request) { - // The request was made but no response was received - title = "Problem with request!"; - msg = "Error occured due to wrong server request!" - console.log(error.request); - } else { - // Something happened in setting up the request that triggered an Error - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - }, - getTeamData() { - const userName = {name: JSON.parse(localStorage.getItem('userToken')).name}; - this.$axios.get('/api/getTeam', {params: userName}) - .then(response => { - console.log("getTeam: " + response); - }).catch((error) => { - // Error - let msg; - let title; - if (error.response) { - // The request was made and the server responded with a status code - title = "Problem with response!"; - msg = error.response; - } else if (error.request) { - // The request was made but no response was received - title = "Problem with request!"; - msg = "Error occured due to wrong server request!" - console.log(error.request); - } else { - // Something happened in setting up the request that triggered an Error - title = "Error"; - msg = error.message; - console.log('Error', error.message); - } - console.log(error.config); - this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,}); - }) - - }, - - dropDownSelectItem(item) { - if (item === 'team') { - this.dropDownSelectedItem = this.teamName; - } else { - this.dropDownSelectedItem = item; - } - }, } } diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue index 2f0d8ad..0741a0c 100644 --- a/frontend/src/pages/Overview.vue +++ b/frontend/src/pages/Overview.vue @@ -29,7 +29,7 @@ expand-separator icon="location_on" :label="cache.name" - :caption="cache.rankingPoints+' Punkte / Size '+cache.stationen.length" + :caption="cache.rankingPoints+' Punkte, '+cache.stationen.length+' Stationen'" >