diff --git a/src/common-components/question-chain/question-chain.vue b/src/common-components/question-chain/question-chain.vue index 950c06e7e..c0192aa7d 100644 --- a/src/common-components/question-chain/question-chain.vue +++ b/src/common-components/question-chain/question-chain.vue @@ -1,23 +1,18 @@ diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index 2fcb76975..a78eefde3 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -9,13 +9,12 @@ -
- {{ part.capabilityQuestions }}

- {{ showThisPartQuestionChain(part, i) }} +
+ v-if="showThisPartQuestionChain(part, i)" + validationRules="questions-required" />
partOrQuestion.glassLocation === answer.glassLocation); const partFromCapabilityQuestionAnswer = (await this.dispatchStoreAction(storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER, answer.glassLocation, false)).data; - partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === damageLocationsSelected.WINDSHIELD).parts = partFromCapabilityQuestionAnswer; + partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === answer.glassLocation).parts = partFromCapabilityQuestionAnswer; } console.log(partsOrQuestions) @@ -171,7 +170,7 @@ export default { // let partsOrQuestions = this.pageData.partsOrQuestions; // partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === damageLocationsSelected.WINDSHIELD).parts = partFromCapabilityQuestionAnswer; - // this.navigateForward(partsOrQuestions); + this.navigateForward(partsOrQuestions); }, handleAnswerUpdates(answer) { // only runs when all questions in a question-chain have been answered @@ -292,6 +291,7 @@ export default { // restore original answerResult if (thisAns.originalAnswerResult) { thisAns.answerResult = thisAns.originalAnswerResult; + thisAns.answerResult1 = thisAns.originalAnswerResult; thisAns.originalAnswerResult = null; } } @@ -306,6 +306,7 @@ export default { thisAns.nextQuestionSequence = null; thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult; thisAns.answerResult = matchedAnswer.answerResult; + thisAns.answerResult1 = matchedAnswer.answerResult; } } }); @@ -341,6 +342,7 @@ export default { // set the answerData as 'already answered' glassPart.answerData = { answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult, + answerResult1: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult, answeredQuestions: [answeredQuestionObj], }; @@ -354,13 +356,22 @@ export default { // Update the key to re-render this part's question-chain component this.capabilityQuestionsData[gpIndex].key = this.capabilityQuestionsData[gpIndex].glassLocation + this.capabilityQuestionsData[gpIndex].glassName + Date.now().toString(); - + console.log("rerendering") + console.log(this.capabilityQuestionsData[gpIndex]) + } - }); - }); + // Need to clear questions for subsequent glassParts as well + console.log(this.capabilityQuestionsData) + // for (let i = currentQuestionChainIndex; i < this.capabilityQuestionsData.length; i++) { + // this.capabilityQuestionsData.map(data => ({ + // ...data, + + // })) + // } + // DETERMINE ANSWERED QUESTIONS LIST FOR THIS GLASS PART // look through all (this part's) part questions for any duplicates that were suppressed; @@ -410,6 +421,7 @@ export default { }); }); + console.log(this.capabilityQuestionsData[1].capabilityQuestions[0].answerSelected) // make sure there are no duplicated dupes in the list... const foundInCompleteAnsweredQuestions = new Set(); let filteredCompleteAnsweredQuestions = completeAnsweredQuestions.filter(el => { @@ -430,15 +442,17 @@ export default { answeredQuestions: filteredCompleteAnsweredQuestions, } + console.log(this.capabilityQuestionsData[1].capabilityQuestions[0].answerSelected) + // this part has been fully answered, so advance to next part's question chain for (let i = answer.partIndex + 1; i < this.capabilityQuestionsData.length; i++) { // if this part has not yet been fully answered, then make it the current part - if (!this.capabilityQuestionsData[i].answerData?.answerSelected) { + if (!this.capabilityQuestionsData[i].answerData?.answerResult) { this.currentQuestionChainIndex = i; break; } } - + console.log(this.capabilityQuestionsData[1].capabilityQuestions[0].answerSelected) }, // TODO I'm sure there's a better/simplier way to do this that I'm missing but my brain's fried // Find the part that has some answer that has an answerResult matching the selected answerResult, then get the corresponding answerResult2 @@ -450,7 +464,6 @@ export default { .answerResult2; }, loadInitialCapabilityQuestionsData() { - // are there alreadyAnsweredQuestions? const alreadyAnsweredQuestions = store.getters.damage.capabilityQuestionAnswers; @@ -486,6 +499,7 @@ export default { // mark this partQuestion as answered (question-chain will read this) part.capabilityQuestions[aq.questionNum - 1].answerSelected = answerString; + console.log("answerSelected set") // mark this partQuestion as duplicate if it is (question-chain will read this) if (aq.suppressQuestion) { part.capabilityQuestions[aq.questionNum - 1].suppressQuestion = true; @@ -506,6 +520,8 @@ export default { }); + console.log("AHHHHH", this.capabilityQuestionsData[1].capabilityQuestions[0].answerSelected) + // Set up watch for each set of part questions, which gets updated when all questions for a part have been answered this.$watch("selectedAnswers." + part.key, (newValue) => { if (newValue) { diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 881eaf90b..7de6eb5a2 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -20,7 +20,7 @@ :manualCopy="AlertFewMoreQuestionsCopy" v-bind:isDismissible="false" /> -
+