Reverted changes to question-chain and force matched the part questions before committing to mainStore
This commit is contained in:
parent
5645139c74
commit
fbfd196da1
2 changed files with 6 additions and 2 deletions
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue