CSR-108: remove no longer needed code block

This commit is contained in:
Adam Caouette 2022-08-19 10:37:07 -04:00
parent 20594b3847
commit 53f1b61176

View file

@ -207,9 +207,7 @@ export default {
const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex];
// remove answerData from this glass part
// delete glassPart.answerData;
glassPart.answerData = null;
// delete glassPart.isSuppressedPart;
glassPart.isSuppressedPart = null;
// Update the key to re-render this part's question-chain component
@ -440,55 +438,6 @@ export default {
return part;
});
// this block is purely for handling duplicate questions
alreadyAnsweredQuestions?.forEach((savedPart, partIndex) => {
savedPart.answeredQuestions.forEach((aq) => {
if (aq.isDuplicateQuestion) {
// find this one in partsQuestionData
const dupedPartsQuestion = this.partsQuestionsData[partIndex].partQuestions[aq.questionNum - 1];
dupedPartsQuestion.suppressDuplicateQuestion = true;
const dupedPartsQuestionAnswer = dupedPartsQuestion.answers.filter((ans) => {
return ans.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
})[0];
let isDupedPartsQuestionFirst;
if (aq.questionNum === 1) { isDupedPartsQuestionFirst = true }
this.partsQuestionsData.forEach((glassPart, i) => {
// loop through this glass part's part questions, looking for a questionText match
glassPart.partQuestions.forEach((pq, pqIndex) => {
// if this dupedQ is the first in the array then
// suppress all questions for this part up until the answer's nextQuestionSequence
if (isDupedPartsQuestionFirst &&
dupedPartsQuestionAnswer.nextQuestionSequence &&
pq.questionSequence < dupedPartsQuestionAnswer.nextQuestionSequence) {
pq.suppressDuplicateQuestion = true;
}
pq.answers.forEach((thisAns) => {
if (thisAns.nextQuestionSequence === aq.questionNum) {
// update either the nextQuestionSequence or the answerResult
if (dupedPartsQuestionAnswer.nextQuestionSequence) {
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
thisAns.nextQuestionSequence = dupedPartsQuestionAnswer.nextQuestionSequence;
// update this change to answerSelected
pq.answerSelected = `${pq.questionSequence}|nextQuestion|${thisAns.nextQuestionSequence}|${thisAns.answerText}`;
} else {
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
thisAns.nextQuestionSequence = null;
thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult;
thisAns.answerResult = dupedPartsQuestionAnswer.answerResult;
}
}
})
});
});
}
})
});
},
},
components: {