CSR-803 standardize naming across questions pages

This commit is contained in:
Adam Caouette 2022-10-10 13:24:56 -04:00
parent 4daa43cd36
commit fbbbf377be

View file

@ -12,7 +12,7 @@
<div v-for="(glass, i) in questionsData" :key="glass.key"> <div v-for="(glass, i) in questionsData" :key="glass.key">
<questionChain ref="questionChain" <questionChain ref="questionChain"
v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]" v-model="selectedAnswers[glass.glassLocation + '-' + glass.glassName]"
:questionData="glass.capabilityQuestions" :glassIndex="i" :questionData="glass.questions" :glassIndex="i"
v-if="showThisQuestionChain(glass, i)" v-if="showThisQuestionChain(glass, i)"
validationRules="questions-required" /> validationRules="questions-required" />
</div> </div>
@ -106,11 +106,11 @@ export default {
return capabilityQuestionsPageData && Object.keys(capabilityQuestionsPageData).length > 0; return capabilityQuestionsPageData && Object.keys(capabilityQuestionsPageData).length > 0;
}, },
showThisQuestionChain(glass, i) { showThisQuestionChain(glass, i) {
if (!glass.capabilityQuestions || glass.capabilityQuestions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no capabilityQuestions or if suppressed if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no capabilityQuestions or if suppressed
return this.currentQuestionChainIndex === i || glass.answerData?.answerResult?.length > 0; return this.currentQuestionChainIndex === i || glass.answerData?.answerResult?.length > 0;
}, },
async forwardButtonAction() { async forwardButtonAction() {
const capabilityQuestionsAnswersArray = this.questionsData.map((glass) => { const questionAnswersArray = this.questionsData.map((glass) => {
const selectedAnswerResult2 = this.getCorrespondingAnswerResult2(glass.answerData.answerResult); const selectedAnswerResult2 = this.getCorrespondingAnswerResult2(glass.answerData.answerResult);
return { return {
@ -130,11 +130,11 @@ export default {
}); });
// save to vuex store as order.damage.capabilityQuestionAnswers (array) // save to vuex store as order.damage.capabilityQuestionAnswers (array)
await this.dispatchStoreAction(this.storeActions.SAVE_CAPABILITY_QUESTION_ANSWERS, capabilityQuestionsAnswersArray, false); await this.dispatchStoreAction(this.storeActions.SAVE_CAPABILITY_QUESTION_ANSWERS, questionAnswersArray, false);
// get parts from the capabilityQuestionAnswers // get parts from the capabilityQuestionAnswers
let partsOrQuestions = this.pageData.partsOrQuestions; let partsOrQuestions = this.pageData.partsOrQuestions;
for (let answer of capabilityQuestionsAnswersArray) { for (let answer of questionAnswersArray) {
const correspondingPart = partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === answer.glassLocation); const correspondingPart = partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === answer.glassLocation);
const partFromCapabilityQuestionAnswer = (await this.dispatchStoreAction(this.storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER, answer.glassLocation, false)).data; const partFromCapabilityQuestionAnswer = (await this.dispatchStoreAction(this.storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER, answer.glassLocation, false)).data;