From 28732539de91967bedce5a44591ddaa1a42c1326 Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Thu, 1 Sep 2022 15:51:54 +0100 Subject: [PATCH] Renamed app store to results store. --- client/src/stores/{app.js => results.js} | 4 ++-- client/src/views/Home.vue | 16 ++++++++++++---- client/src/views/about/Index.vue | 19 +++++++++++++++++++ client/src/views/quiz/Index.vue | 8 ++++---- client/src/views/quiz/Question.vue | 10 +++++----- client/src/views/results/CompareResults.vue | 18 +++++++++--------- client/src/views/results/Index.vue | 8 ++++---- client/src/views/results/Results.vue | 10 +++++----- client/src/views/results/Scores.vue | 10 +++++----- client/src/views/results/Statistics.vue | 18 +++++++++--------- .../compare-answers/CompareQuestion.vue | 18 +++++++++--------- .../compare-answers/CompareQuestions.vue | 10 +++++----- .../views/results/compare-answers/Index.vue | 10 +++++----- 13 files changed, 93 insertions(+), 66 deletions(-) rename client/src/stores/{app.js => results.js} (83%) diff --git a/client/src/stores/app.js b/client/src/stores/results.js similarity index 83% rename from client/src/stores/app.js rename to client/src/stores/results.js index 58423e7..157795a 100644 --- a/client/src/stores/app.js +++ b/client/src/stores/results.js @@ -1,7 +1,7 @@ import { defineStore } from 'pinia' -export const useAppStore = defineStore({ - id: 'app', +export const useResultsStore = defineStore({ + id: 'results', state: () => ({ answers: [], playbooks: {}, diff --git a/client/src/views/Home.vue b/client/src/views/Home.vue index d34c073..0e699bb 100644 --- a/client/src/views/Home.vue +++ b/client/src/views/Home.vue @@ -1,5 +1,6 @@ diff --git a/client/src/views/about/Index.vue b/client/src/views/about/Index.vue index 4343ccd..2f5169c 100644 --- a/client/src/views/about/Index.vue +++ b/client/src/views/about/Index.vue @@ -1,9 +1,28 @@ diff --git a/client/src/views/quiz/Index.vue b/client/src/views/quiz/Index.vue index b03922a..a1c6583 100644 --- a/client/src/views/quiz/Index.vue +++ b/client/src/views/quiz/Index.vue @@ -3,18 +3,18 @@ import Config from '@/config.js' import { useQuestionStore } from '@/stores/questions.js' import { useAnswersStore } from '@/stores/answers.js' - import { useAppStore } from '@/stores/app.js' + import { useResultsStore } from '@/stores/results.js' export default { setup() { const questionStore = useQuestionStore() const answersStore = useAnswersStore() - const appStore = useAppStore() + const resultsStore = useResultsStore() return { questionStore, answersStore, - appStore + resultsStore } }, name: 'QuestionIndex', @@ -28,8 +28,8 @@ this.$router.push(`/quiz/question/${this.answersStore.quizCurrent}`) } else { this.answersStore.$reset() - this.appStore.$reset() } + this.resultsStore.$reset() }, methods: { getQuestions() { diff --git a/client/src/views/quiz/Question.vue b/client/src/views/quiz/Question.vue index 34a6570..732be38 100644 --- a/client/src/views/quiz/Question.vue +++ b/client/src/views/quiz/Question.vue @@ -3,7 +3,7 @@ import Config from '@/config.js' import { useQuestionStore } from '@/stores/questions.js' import { useAnswersStore } from '@/stores/answers.js' - import { useAppStore } from '@/stores/app.js' + import { useResultsStore } from '@/stores/results.js' import Content from '@/components/Content.vue' import Header from '@/components/Header.vue' import TextFrame from '@/components/TextFrame.vue' @@ -15,12 +15,12 @@ setup() { const questionStore = useQuestionStore() const answersStore = useAnswersStore() - const appStore = useAppStore() + const resultsStore = useResultsStore() return { questionStore, answersStore, - appStore + resultsStore } }, components: { @@ -69,8 +69,8 @@ } } ).then( (response) => { - console.log('Submitted results.') - this.appStore.store('results', response.data) + console.log('Submitted answers.') + this.resultsStore.store('results', response.data) console.log('Results fetched from the server.') this.answersStore.quizCurrent = null this.$router.push('/results') diff --git a/client/src/views/results/CompareResults.vue b/client/src/views/results/CompareResults.vue index 1415843..d57519e 100644 --- a/client/src/views/results/CompareResults.vue +++ b/client/src/views/results/CompareResults.vue @@ -4,15 +4,15 @@ import Content from '@/components/Content.vue' import Header from '@/components/Header.vue' import TextFrame from '@/components/TextFrame.vue' - import { useAppStore } from '@/stores/app.js' + import { useResultsStore } from '@/stores/results.js' import ChevronDoubleRight from '@/components/icons/ChevronDoubleRight.vue' export default { setup() { - const appStore = useAppStore() + const resultsStore = useResultsStore() return { - appStore + resultsStore } }, mounted() { @@ -30,7 +30,7 @@ axios.get(`${Config.SERVER}api/playbooks/`) .then((response) => { console.log('Fetched playbook stats from the server.') - this.appStore.store('playbooks', response.data) + this.resultsStore.store('playbooks', response.data) }) .catch( error => { console.log(error) @@ -39,7 +39,7 @@ axios.get(`${Config.SERVER}api/count/`) .then((response) => { console.log('Fetched user count from the server.') - this.appStore.store('count', response.data) + this.resultsStore.store('count', response.data) }) .catch( error => { console.log(error) @@ -76,8 +76,8 @@ - - + + @@ -90,11 +90,11 @@ {{ number }} - {{ Math.round(100*number/this.appStore.count) }} % + {{ Math.round(100*number/this.resultsStore.count) }} % - Out of {{ this.appStore.count }} users + Out of {{ this.resultsStore.count }} users diff --git a/client/src/views/results/Index.vue b/client/src/views/results/Index.vue index b0a2c4c..6cd7b87 100644 --- a/client/src/views/results/Index.vue +++ b/client/src/views/results/Index.vue @@ -1,13 +1,13 @@