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A,KAOzB,OALkB,OAAdoC,QAAc,IAAdA,OAAc,EAAdA,EAAgBQ,QAAS,IAAkB,OAAbzC,QAAa,IAAbA,OAAa,EAAbA,EAAeyC,QAAS,IACtDH,EAAOI,MAAM,uCAAwCT,EAAeQ,MAAOzC,EAAcyC,OACzFD,EAAiBb,iBAAiBM,EAAeQ,MAAOzC,EAAcyC,QAGnE,CAACE,EAAUC,KACTC,EAAAA,EAAAA,YAAYF,EAAKG,OAAQ,UAElC,IC9BA,MAAMC,EAAc,EAEpB,O","sources":["webpack://beliefnet-frontend/./src/stores/PersonalityQuiz.ts","webpack://beliefnet-frontend/./src/components/quiz/personality/Question.vue?19af","webpack://beliefnet-frontend/./src/components/quiz/personality/Question.vue"],"sourcesContent":["import { defineStore } from 'pinia';\n\nexport const usePersonalityQuizStore = defineStore('PersonalityQuiz', {\n state: () => {\n return {\n correctAnswer: [] as number[],\n weight: [] as number[],\n answerTypeQuiz: false\n };\n },\n getters: {\n total: (state) => state.weight.reduce((a, b) => a + b),\n getNumberOfCorrectAnswers(state) {\n let count = 0;\n\n // count the number of correct answers\n state.weight.forEach((answer, index) => {\n if (index + 1 <= state.correctAnswer.length) {\n if (answer == state.correctAnswer[index]) {\n count++;\n }\n }\n });\n\n return count;\n },\n isAnswerTypeQuiz: (state) => state.answerTypeQuiz,\n canShowUserResult(state) {\n // only show if there aren't any -1s in the user answer array\n return state.weight.filter((val) => val === -1).length === 0;\n },\n numberOfQuestions: (state) => state.weight.length,\n nextQuestion() {\n return (currentQuestion: number) => {\n const nextQuestion = ++currentQuestion;\n if (nextQuestion < this.numberOfQuestions) {\n return nextQuestion;\n }\n\n return -1;\n };\n }\n },\n actions: {\n reset(numberOfQuestions: number) {\n this.weight = Array(numberOfQuestions).fill(-1);\n this.correctAnswer = Array(numberOfQuestions).fill(-1);\n this.answerTypeQuiz = false;\n },\n setAnswerTypeQuiz() {\n this.answerTypeQuiz = true;\n },\n setCorrectAnswer(question: number, answer: number) {\n this.correctAnswer[question] = answer;\n },\n setUserAnswer(question: number, answer: number) {\n this.weight[question] = answer;\n }\n }\n});\n","import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot } from \"vue\"\n\nimport { toRefs } from 'vue';\nimport { useLogger } from 'vue-logger-plugin';\nimport { usePersonalityQuizStore } from '../../../stores/PersonalityQuiz';\n\n// Incoming props\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'Question',\n props: { questionNumber: Number, correctAnswer: Number },\n setup(__props) {\n\nconst props = __props;\n\n\n// get back prop values\nconst { questionNumber, correctAnswer } = toRefs(props);\n\n// use logger\nconst logger = useLogger();\n\nconst personalityStore = usePersonalityQuizStore();\n// check if we have correct answer\nif (questionNumber?.value >= 0 && correctAnswer?.value >= 0) {\n logger.debug('Setting question with correct answer', questionNumber.value, correctAnswer.value);\n personalityStore.setCorrectAnswer(questionNumber.value, correctAnswer.value);\n}\n\nreturn (_ctx: any,_cache: any) => {\n return _renderSlot(_ctx.$slots, \"default\")\n}\n}\n\n})","import script from \"./Question.vue?vue&type=script&setup=true&lang=ts\"\nexport * from \"./Question.vue?vue&type=script&setup=true&lang=ts\"\n\nconst __exports__ = script;\n\nexport default __exports__"],"names":["usePersonalityQuizStore","defineStore","state","correctAnswer","weight","answerTypeQuiz","getters","total","reduce","a","b","getNumberOfCorrectAnswers","count","forEach","answer","index","length","isAnswerTypeQuiz","canShowUserResult","filter","val","numberOfQuestions","nextQuestion","currentQuestion","this","actions","reset","Array","fill","setAnswerTypeQuiz","setCorrectAnswer","question","setUserAnswer","_defineComponent","__name","props","questionNumber","Number","setup","__props","toRefs","logger","useLogger","personalityStore","value","debug","_ctx","_cache","_renderSlot","$slots","__exports__"],"sourceRoot":""}