Updating QuestionData answer to match Question answer during deletion

This commit is contained in:
Kirkland Brown 2024-07-08 10:22:32 -04:00
parent a484af7982
commit 5645139c74

View file

@ -123,7 +123,7 @@ export default {
const answeredQuestions = [];
// TODO: This forEach could probably be converted into something more reactive
this.questions.forEach((q) => {
this.questions.forEach((q, index) => {
// find this question and mark it as "answered" by populating answerSelected
if (q.questionSequence === questionNum) {
q.answerSelected = returnedAnswer;
@ -134,6 +134,7 @@ 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({