From 3f109d244ea82dec4b6c6e40819202fad0b17965 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 8 Jan 2024 13:53:31 -0500 Subject: [PATCH 1/3] CSR-1610: another attempt to fix load issue for saved sessions --- src/layouts/part-questions/part-questions.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 113e91e42..08eecfc14 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -5,11 +5,13 @@ :isMetaValid="meta.valid" :alertFewMoreQuestionsHeader="AlertFewMoreQuestionsHeader" :alertFewMoreQuestionsCopy="AlertFewMoreQuestionsCopy" + v-if="questionsData" :questionsData="questionsData" validationRules="questions-required" v-model="selectedAnswers" @forwardButtonAction="forwardButtonAction" @back-click="navigateBack" + :key="currentGlassIndex" :index="currentGlassIndex" /> @@ -55,7 +57,7 @@ export default { }, data() { return { - questionsData: [], + questionsData: null, selectedAnswers: {}, currentGlassIndex: 0, }; @@ -71,7 +73,7 @@ export default { return this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions; }, }, - created() { + mounted() { this.getInitialQuestionData(); }, methods: { @@ -117,6 +119,14 @@ export default { return updatedGlass; }); + + // if no preanswered questions then make sure index starts with the correct value + if (this.currentGlassIndex === 0) { + this.currentGlassIndex = this.questionsData?.findIndex( + (glass) => glass.questions?.length > 0 + ); + } + }, async forwardButtonAction() { const questionAnswersArray = this.questionsData.map((glass) => { From e98875370775f12def62b6f3c21e4603b28ab8e6 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 8 Jan 2024 15:29:46 -0500 Subject: [PATCH 2/3] CSR-1610: reformatting from prettier --- src/layouts/part-questions/part-questions.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 08eecfc14..d9fbd369d 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -119,14 +119,13 @@ export default { return updatedGlass; }); - + // if no preanswered questions then make sure index starts with the correct value if (this.currentGlassIndex === 0) { this.currentGlassIndex = this.questionsData?.findIndex( (glass) => glass.questions?.length > 0 ); } - }, async forwardButtonAction() { const questionAnswersArray = this.questionsData.map((glass) => { From 6d269ada669e46ed0146cbed0fed9ffced37237b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 8 Jan 2024 15:35:42 -0500 Subject: [PATCH 3/3] CSR-1610: fix unit test --- src/digital-components/question-chain/question-chain.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/digital-components/question-chain/question-chain.spec.js b/src/digital-components/question-chain/question-chain.spec.js index 2444fd22d..d516afc03 100644 --- a/src/digital-components/question-chain/question-chain.spec.js +++ b/src/digital-components/question-chain/question-chain.spec.js @@ -265,8 +265,8 @@ describe("Question Chain component", () => { ], }, ], - index: 0, }); + await wrapper.setProps({ index: 0 }); //Act const result = wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer);