diff --git a/src/digital-components/question-chain/question-chain.vue b/src/digital-components/question-chain/question-chain.vue index 217c6dcb..5f72221f 100644 --- a/src/digital-components/question-chain/question-chain.vue +++ b/src/digital-components/question-chain/question-chain.vue @@ -123,7 +123,7 @@ export default { const answeredQuestions = []; // TODO: This forEach could probably be converted into something more reactive - this.questions.forEach((q, index) => { + this.questions.forEach((q) => { // find this question and mark it as "answered" by populating answerSelected if (q.questionSequence === questionNum) { q.answerSelected = returnedAnswer; @@ -134,7 +134,6 @@ export default { // (needed in case user is changing previously answered questions) if (q.questionSequence > questionNum) { delete q.answerSelected; - delete this.questionData[index].answerSelected; } if (q.answerSelected) { answeredQuestions.push({ diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 286008c8..d20d15c4 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -126,6 +126,11 @@ export default { ); }, async forwardButtonAction() { + // match partQuestionAnswers to answerData + const questionNums = new Set(this.questionsData[0].answerData.answeredQuestions.map(obj => obj.questionNum)); + this.questionsData.partQuestions = this.questionsData[0].partQuestions.map(obj => {if(!questionNums.has(obj.questionSequence)) delete obj.answerSelected}); + this.questionsData.partQuestions = this.questionsData[0].questions.map(obj => {if(!questionNums.has(obj.questionSequence)) delete obj.answerSelected}); + const questionAnswersArray = this.questionsData.map((glass) => ({ glassLocation: glass.glassLocation, glassName: glass.glassName,