diff --git a/src/common-components/question-chain/question-chain.vue b/src/common-components/question-chain/question-chain.vue index 6f52d8e70..54b953c09 100644 --- a/src/common-components/question-chain/question-chain.vue +++ b/src/common-components/question-chain/question-chain.vue @@ -33,51 +33,54 @@ export default { questionData: Object, validationRules: String, modelValue: Array, - partIndex: Number, + glassPartIndex: Number, keyString: String, }, async created() { // validate form upon create to prevent out of sync / persistent valid states await useValidateForm(); // do a test validation check, without triggering full validation + console.log(" _ QC, START CREATE this.questionData: ", this.questionData) + + this.questionData.map((q, i) => { - let answerPair = []; - const question = { - questionText: q.questionText, - questionSequence: q.questionSequence, - answers: q.answers.map((a) => { - answerPair.push(a.nextQuestionSequence ? a.nextQuestionSequence : a.answerResult); - return { - Text: a.answerText, - // Name will either be nextQuestionSequence or answerResult - // Name will be used by list-button as the input value. - // It must be a single string or number, so concatenating together a string with - // 4 pieces of data separated by pipe characters: - // question number|type of answer|answer value|answer text - Name: a.nextQuestionSequence ? - q.questionSequence + "|nextQuestion|" + a.nextQuestionSequence + "|" + a.answerText : - q.questionSequence + "|answer|" + a.answerResult + "|" + a.answerText, - nextQuestionSequence: a.nextQuestionSequence, - answerResult: a.answerResult, - questionSequence: q.questionSequence, - questionType: a.nextQuestionSequence ? "nextQuestion" : "answer", - } - }), - answerSelected: q.answerSelected || "", - }; - question.answerPair = answerPair; - if (!q.suppressQuestion) { - this.questions.push(question); - } + let answerPair = []; + const question = { + questionText: q.questionText, + questionSequence: q.questionSequence, + answers: q.answers.map((a) => { + answerPair.push(a.nextQuestionSequence ? a.nextQuestionSequence : a.answerResult); + return { + Text: a.answerText, + // Name will either be nextQuestionSequence or answerResult + // Name will be used by list-button as the input value. + // It must be a single string or number, so concatenating together a string with + // 4 pieces of data separated by pipe characters: + // question number|type of answer|answer value|answer text + Name: a.nextQuestionSequence ? + q.questionSequence + "|nextQuestion|" + a.nextQuestionSequence + "|" + a.answerText : + q.questionSequence + "|answer|" + a.answerResult + "|" + a.answerText, + nextQuestionSequence: a.nextQuestionSequence, + answerResult: a.answerResult, + questionSequence: q.questionSequence, + questionType: a.nextQuestionSequence ? "nextQuestion" : "answer", + } + }), + answerSelected: q.answerSelected || "", + }; + question.answerPair = answerPair; + if (!q.suppressQuestion) { + this.questions.push(question); + } }); - if (!this.modelValue?.length > 0) { - // set this.currentQuestionNum to first valid question - this.currentQuestionNum = this.questions[0].questionSequence; - // scroll the next question into view - this.$nextTick(() => { - document.querySelector('.current-question').scrollIntoView({behavior: "smooth"}); - }) + if (!this.modelValue?.length > 0 && this.questions.length > 0) { + // set this.currentQuestionNum to first valid question + this.currentQuestionNum = this.questions[0].questionSequence; + // scroll the next question into view + this.$nextTick(() => { + document.querySelector('.current-question').scrollIntoView({behavior: "smooth"}); + }) } }, methods: { @@ -151,7 +154,7 @@ export default { return { answerResult: questionAnswer, answeredQuestions: answeredQuestions, - partIndex: this.partIndex, + glassPartIndex: this.glassPartIndex, }; } diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index a80694834..8d03c5b95 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -23,6 +23,7 @@ const storeActions = { GET_PARTS: "getParts", GET_CAPABILITY_QUESTIONS: "getCapabilityQuestions", GET_PART_FROM_CAPABILITY_QUESTION_ANSWER: "getPartFromCapabilityQuestionAnswer", + GET_MOLDING_QUESTIONS: "getMoldingQuestions", SAVE_ORDER: "saveOrder", LOAD_ORDER: "loadOrder", UPDATE_STORE_WITH_SAVE_ORDER_RESPONSE: "updateStoreWithSaveOrderResponse", @@ -57,6 +58,7 @@ const storeActions = { SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", SAVE_GLASS_PARTS: "saveGlassParts", SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers", + SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers" }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index ba0adc7cb..51574f08d 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -17,6 +17,7 @@ const storeMutations = { UPDATE_NUMBER_OF_CHIPS: "updateNumberOfChips", UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace", UPDATE_PART_QUESTION_ANSWERS: "updatePartQuestionAnswers", + UPDATE_MOLDING_QUESTION_ANSWERS: "updateMoldingQuestionAnswers", UPDATE_CAPABILITY_QUESTION_ANSWERS: "updateCapabilityQuestionAnswers", UPDATE_GLASS_PARTS: "updateGlassParts", UPDATE_OTHER_PARTS: "updateOtherParts", diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index 67ffe5745..25adda1e1 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -11,22 +11,23 @@
-

MOLDING QUESTIONS TEMPORARY PLACEHOLDER

-
+
@@ -63,7 +64,6 @@ import { Form, defineRule } from "vee-validate"; import { required } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; -import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES defineRule("questions-required", required(errorMessages.OPTION_REQUIRED)); @@ -92,89 +92,391 @@ export default { }, data() { return { - selectedModel: [], - partsQuestionsData: this.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS).partsOrQuestions.filter((p) => { - if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) { - return { - glassName: p.glassName, - glassLocation: p.glassLocation, - partQuestions: p.partQuestions, - }; - } - }), + moldingQuestionsData: store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS).partsOrQuestions, + selectedAnswers: {}, currentPartNum: 0, + foundDuplicateQuestions: [], }; }, computed: { AlertFewMoreQuestionsHeader() { - return this.getCmsContent("AlertPartsQuestions", "HeadlineText"); + return this.getCmsContent("AdditionalPartsQuestionsAlert", "HeadlineText"); }, AlertFewMoreQuestionsCopy() { - return this.getCmsContent("AlertPartsQuestions", "BodyText"); + return this.getCmsContent("AdditionalPartsQuestionsAlert", "BodyText"); }, + pageData() { + return this.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS); + } + }, + mounted() { + this.LoadInitialData(); }, methods: { arePagePrerequisitesValid() { - return false; // TODO - DO TRUE TEST OF PAGEDATA - // return Object.keys(store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)).length > 0; + const moldingQuestionsFromPageData = store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS); + return moldingQuestionsFromPageData && Object.keys(moldingQuestionsFromPageData).length > 0; }, - showThisPartQuestionChain(part, i) { - if (part.partQuestions?.length < 1) { return false; } // return false if only one partQuestion - if (this.currentPartNum === i || part.answerData?.answerResult.length > 0) { return true; } - return false; - }, - backButtonAction() { - // route to move backwards - this.$router.navigateWithoutSaving( - this.navigationScenarios.CLICKED_BACK, - this.$route - ); + showThisQuestionChain(glassPart, i) { + if (part.partQuestions?.length < 1 || part.isSuppressedPart) { return false; } // return false if no partQuestions or if suppressed + return this.currentPartNum === i || glassPart.answerData?.answerResult?.length > 0; }, async forwardButtonAction() { - const partQuestionAnswersArray = this.partsQuestionsData.map((item) => { + const questionAnswersArray = this.moldingQuestionsData.map((glassPart) => { return { - glassLocation: item.glassLocation, - glassName: item.glassName, - result: item.answerData.answerResult, - answeredQuestions: item.answerData.answeredQuestions, + glassLocation: glassPart.glassLocation, + glassName: glassPart.glassName, + partNum: glassPart.answerData.answerResult, + answeredQuestions: glassPart.answerData.answeredQuestions, + isSuppressedPart: glassPart.isSuppressedPart, }; }); - // save to vuex store as order.damage.partQuestionAnswers (array) - await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, partQuestionAnswersArray, false); + // clear out answerData for future page loads; must occur prior to store save + this.moldingQuestionsData.forEach((glassPart) => { + glassPart.answerData = {}; + }); + + // save to vuex store as order.damage.partQuestionAnswers (array) + await this.dispatchStoreAction(this.storeActions.SAVE_MOLDING_QUESTION_ANSWERS, questionAnswersArray, false); + + // get parts from the questionAnswers + let partsOrQuestions = this.pageData.partsOrQuestions; + for (let answer of questionAnswersArray) { + partsOrQuestions.find(partOrQuestion => { + return partOrQuestion.glassLocation === answer.glassLocation && partOrQuestion.glassName === answer.glassName; + }).parts[0].childParts = [ + { + partNumber: answer.partNum + } + ]; + } + + this.navigateForward(partsOrQuestions); + }, + handleAnswerUpdates(key, answer) { + // only runs when all questions in a question-chain have been answered + // when selectedAnswers updates, user has completed this part's question chain and has a final answer + // (does not get run for each invididual question's answer, only when + // all relevent questions for the current part have been answered) + + /* + answer example format: + { + "answerResult": "DD11132", + "answeredQuestions": [ + { + "questionText": "Is your Grand Cherokee the Laredo model?", + "selectedAnswerText": "Yes", + "questionNum": 1, + } + ], + "glassPartIndex": 0 + } + */ + + // collect a list of the answered questions' numbers, needed later below + const answeredQuestionIndexes = []; + + // if user has answered a question differently than anything that was preloaded, + // we need to clear out any preloaded answers + this.selectedAnswers = {}; + + // loop through every answered question on the currently answered glass part + answer.answeredQuestions?.forEach((aq) => { + + // keep track of this question number + answeredQuestionIndexes.push(aq.questionNum); + + const answeredQuestionText = aq.questionText.toUpperCase(); + const answeredQuestionAnswer = aq.selectedAnswerText.toUpperCase(); + + // HANDLE DUPLICATE QUESTIONS + + // loop through all glass parts data + this.moldingQuestionsData.forEach((glassPart, gpIndex) => { + + // only look for duplicates forward... to parts that follow after the currently being answered part + if (gpIndex > answer.glassPartIndex) { + + let suppressUntil; + // reset this glass part, in case user is changing their previous answers + glassPart.answerData = null; + glassPart.isSuppressedPart = null; + + // loop through this glass part's part questions, looking for a questionText match + glassPart.questions.forEach((pq, pqIndex) => { + + // clear out any previously set answers + pq.answerSelected = null; + + // clear or set suppressQuestion property for each question + if (suppressUntil) { + // if suppressUntil has been set, then suppress this question if before it + if (pqIndex + 1 < suppressUntil) { + pq.suppressQuestion = true; + } else { + pq.suppressQuestion = null; + } + } else { + pq.suppressQuestion = null; + } + + // if these match then we have a duplicate question + if (pq.questionText.toUpperCase() === answeredQuestionText) { + + const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex]; + let matchedAnswer; + let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers... + + // which one of this partQuestions' answers matches our answer? + pq.answers.forEach((ans) => { + if (ans.answerText.toUpperCase() === answeredQuestionAnswer) { + matchedAnswer = ans; + ans.selected = true; + } else { + rejectedAnswers.push(ans); + ans.selected = null; + } + }); + + // Update the key to re-render this part's question-chain component + this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString(); + + // handle suppressing downstream in this question chain + + if (matchedAnswer.nextQuestionSequence) { + // ensure that the question that the accepted answer has set to be next is NOT suppressed + glassPart.partQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null; + // if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number + if (pqIndex === 0) { + if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence } + if (matchedAnswer.nextQuestionSequence < suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence} + } + } + + // handle suppressing upstream in this question chain + glassPart.partQuestions.forEach((q) => { + q.answers.forEach((thisAns) => { + // restore any of the answers that formerly led to the duplicated question + if (thisAns.originalNextQuestionSequence === pq.questionSequence) { + // restore original nextQuestionSequence + thisAns.nextQuestionSequence = thisAns.originalNextQuestionSequence; + this.originalNextQuestionSequence = null; + // restore original answerResult + if (thisAns.originalAnswerResult) { + thisAns.answerResult = thisAns.originalAnswerResult; + thisAns.originalAnswerResult = null; + } + } + // search for any answers that lead to the duplicated question + if (thisAns.nextQuestionSequence === pq.questionSequence) { + // update either the nextQuestionSequence or the answerResult + if (matchedAnswer.nextQuestionSequence) { + thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence; + thisAns.nextQuestionSequence = matchedAnswer.nextQuestionSequence; + } else { + thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence; + thisAns.nextQuestionSequence = null; + thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult; + thisAns.answerResult = matchedAnswer.answerResult; + } + } + }); + }); + + // suppress current question + thisAnsweredPartQuestion.suppressQuestion = true; + + const thisGlassPart = "glassPart" + gpIndex; + if (this.foundDuplicateQuestions[thisGlassPart]) { + if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) { + this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence); + } + } else { + this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredPartQuestion.questionSequence]; + } + + // are there any questions left that are not suppressed? + const remainingQuestions = glassPart.partQuestions.filter((q) => { + return !q.suppressQuestion; + }); + + if (remainingQuestions.length < 1) { + // this is the final answer for this glass part + + // mark this part as completely answered by adding answerData + const answeredQuestionObj = { + questionText: pq.questionText, + selectedAnswerText: matchedAnswer.answerText, + questionNum: pq.questionSequence, + suppressQuestion: pq.suppressQuestion, + }; + // set the answerData as 'already answered' + glassPart.answerData = { + answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult, + answeredQuestions: [answeredQuestionObj], + }; + + // suppress this glassPart because it has an answer + glassPart.isSuppressedPart = true; + } + + } + + }); + + // Update the key to re-render this part's question-chain component + this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString(); + + } - // call API parts method - const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS) - .catch(() => { - return this.$refs.funnelFooter.removeLoader(); }); - const glassNameAndPartsForStore = partsLookup.data.glassNameAndPartsForStore; + }); - const hasCapabilityQuestions = this.hasCapabilityQuestions(glassNameAndPartsForStore); + // DETERMINE ANSWERED QUESTIONS LIST FOR THIS GLASS PART - if (hasCapabilityQuestions) { - // if has capability questions - // go to capability-questions page - this.$router.navigateWithSaving(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); - } else { - // if single parts only - const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore); - // save to store lineItems.glassParts - this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); - // go to heritage quote page - this.$refs.loadingModal.showModal(); - navigateToHeritageFunnel(); + // look through all (this part's) part questions for any duplicates that were suppressed; + // add them to the list of answered questions if found + + // EX answeredQuestionIndexes: [1,5,11,13] + + // EX this.foundDuplicateQuestions = { + // "glassPart1": [1], + // "glassPart2": [7, 10] + // }; + + const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.glassPartIndex]; + const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : []; + const glassPartAnswered = this.moldingQuestionsData[answer.glassPartIndex]; + + thisPartsDupes?.forEach((dupe) => { + // dupe is a single integer + const dupeQuestion = glassPartAnswered.partQuestions[dupe - 1]; + const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true); + + glassPartAnswered.partQuestions.forEach((q) => { + let includeThisDupeInAnsweredQuestions = false; + + // did one of the answers of this question point to the duplicated question? + q.answers.forEach((a) => { + if ((dupe === a.originalNextQuestionSequence) && + (answeredQuestionIndexes.includes(q.questionSequence)) && + (a.answerText.toUpperCase() === dupeQuestionAnswer.answerText.toUpperCase())) { + includeThisDupeInAnsweredQuestions = true; + } + }); + + // is this q.questionSequence listed as the duplicated question's nextQuestionSequence? + if ((q.questionSequence === dupeQuestionAnswer.nextQuestionSequence) && (answeredQuestionIndexes.includes(q.questionSequence))) { + includeThisDupeInAnsweredQuestions = true; + } + + if (includeThisDupeInAnsweredQuestions) { + completeAnsweredQuestions.push({ + questionNum: dupeQuestion.questionSequence, + questionText: dupeQuestion.questionText, + selectedAnswerText: dupeQuestionAnswer.answerText, + suppressQuestion: dupeQuestion.suppressQuestion, + }); + } + }); + }); + + // make sure there are no duplicated dupes in the list... + const foundInCompleteAnsweredQuestions = new Set(); + let filteredCompleteAnsweredQuestions = completeAnsweredQuestions.filter(el => { + const duplicate = foundInCompleteAnsweredQuestions.has(el.questionText); + foundInCompleteAnsweredQuestions.add(el.questionText); + return !duplicate; + }); + filteredCompleteAnsweredQuestions = filteredCompleteAnsweredQuestions.sort((a,b) => a.questionNum - b.questionNum); + + // set final answer data for the current answered glass part + glassPartAnswered.answerData = { + answerResult: answer.answerResult, + answeredQuestions: filteredCompleteAnsweredQuestions, } + + // this part has been fully answered, so advance to next molding question chain + for (let i = answer.glassPartIndex + 1; i < this.moldingQuestionsData.length; i++) { + // if this part has not yet been fully answered, then make it the current part + if (!this.moldingQuestionsData[i].answerData?.answerResult) { + this.currentPartNum = i; + break; + } + } + }, - }, - watch: { - selectedModel(model) { - this.moldingQuestionsData[model.partIndex].answerData = { - answerResult: model.answerResult, - answeredQuestions: model.answeredQuestions, - } - this.currentPartNum = model.partIndex + 1; + LoadInitialData() { + + // are there alreadyAnsweredQuestions? + const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers; + + this.moldingQuestionsData = this.pageData.partsOrQuestions.filter(x => x.parts[0].childPartQuestions.length).map((glassPart, i) => { + glassPart.key = glassPart.glassLocation + "-" + glassPart.glassName; + // NOTE: property "questions" can differ between layouts + glassPart.questions = glassPart.parts[0].childPartQuestions; + + this.selectedAnswers[glassPart.key] = []; + if (!alreadyAnsweredQuestions) { + glassPart.answerData = null; + } + + alreadyAnsweredQuestions?.forEach((savedPart) => { + + if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) { + return; + } + if (glassPart.glassLocation === savedPart.glassLocation && glassPart.glassName === savedPart.glassName) { + let answerString = ""; + + // matches; loop through answeredQuestions for matches + savedPart.answeredQuestions.forEach((aq) => { + if (!aq.questionNum || !aq.selectedAnswerText) { + return; + } + // determine which answer was previously chosen + const theAns = glassPart.partQuestions[aq.questionNum-1].answers.find((a) => { + return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase(); + }); + if (theAns.nextQuestionSequence) { + answerString = `${aq.questionNum}|nextQuestion|${theAns.nextQuestionSequence}|${theAns.answerText}` + } else { + answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}` + } + + // mark this partQuestion as answered (question-chain will read this) + glassPart.partQuestions[aq.questionNum-1].answerSelected = answerString; + // mark this partQuestion as duplicate if it is (question-chain will read this) + if (aq.suppressQuestion) { + glassPart.partQuestions[aq.questionNum-1].suppressQuestion = true; + } + }); + + // advance the currentPartNum + this.currentPartNum = i; + + // add answerData to current glassPart + glassPart.answerData = { + answerResult: savedPart.result, + answeredQuestions: savedPart.answeredQuestions + } + } + + }); + + // Set up watch for each set of glassPart questions, which gets updated when all questions for a glassPart have been answered + this.$watch("selectedAnswers." + glassPart.key, (newValue) => { + if (newValue) { + this.handleAnswerUpdates(glassPart.key, newValue); + } + }, {deep: true}) + + return glassPart; + }); + }, }, components: { diff --git a/src/store/index.js b/src/store/index.js index 9c81b88e0..62937b6c4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -49,6 +49,7 @@ const getDefaultState = () => { numberOfChips: null, glassToReplace: null, partQuestionAnswers: null, + moldingQuestionAnswers: null, capabilityQuestionAnswers: null }, lineItems: { @@ -127,6 +128,9 @@ export const mutations = { updatePartQuestionAnswers(state, answersArray) { state.order.damage.partQuestionAnswers = answersArray; }, + updateMoldingQuestionAnswers(state, answersArray) { + state.order.damage.moldingQuestionAnswers = answersArray; + }, updateCapabilityQuestionAnswers(state, answersArray) { state.order.damage.capabilityQuestionAnswers = answersArray; }, @@ -281,6 +285,7 @@ export const mutations = { resetGlassPartsState(state) { state.order.lineItems.glassParts = null; state.order.damage.partQuestionAnswers = null; + state.order.damage.moldingQuestionAnswers = null; state.order.damage.capabilityQuestionAnswers = null; state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null; state.applicationUser.pageData[fmgPageValues.VEHICLE_PARTS] = null; @@ -1002,12 +1007,19 @@ export const actions = { !previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result); if (havePartQuestionAnswersChanged) { + context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null); context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null); + state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null; + state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null; } //Save new values context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray); }, + saveMoldingQuestionAnswers(context, moldingQuestionAnswers) { + //Save new values + context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, moldingQuestionAnswers); + }, saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) { //Save new values context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, capabilityQuestionAnswers);