CSR-480: remove unused computeds, formatting

This commit is contained in:
Adam Caouette 2022-06-13 20:58:38 -04:00
parent f1380cfe2f
commit 6164be582b

View file

@ -55,15 +55,6 @@ export default {
questions.unshift({}); questions.unshift({});
return questions; return questions;
}, },
questionText() {
return this.questions[this.currentQuestion]?.questionText;
},
questionAnswers() {
return this.questions[this.currentQuestion]?.answers;
},
questionGroupname() {
return `${this.questionData.glassName}-${this.questionData.glassLocation}-${this.currentQuestion}`;
},
selectedValue: { selectedValue: {
get: function() { get: function() {
return this.modelValue; return this.modelValue;
@ -78,50 +69,50 @@ export default {
} }
}, },
methods: { methods: {
getNewModelValue(returnedAnswer) { getNewModelValue(returnedAnswer) {
if (!returnedAnswer || !Array.isArray(returnedAnswer)) { return false } if (!returnedAnswer || !Array.isArray(returnedAnswer)) { return false }
const lastAnswer = returnedAnswer[returnedAnswer.length - 1]; const lastAnswer = returnedAnswer[returnedAnswer.length - 1];
const currentQuestion = this.questions[this.currentQuestion]; const currentQuestion = this.questions[this.currentQuestion];
console.log('currentQuestion: ', currentQuestion) console.log('currentQuestion: ', currentQuestion)
console.log('currentQuestion.answers: ', currentQuestion.answers) console.log('currentQuestion.answers: ', currentQuestion.answers)
if (lastAnswer.indexOf("answer-") === 0) { if (lastAnswer.indexOf("answer-") === 0) {
// if it is an answerResult // if it is an answerResult
const finalAnswer = lastAnswer.slice(7); const finalAnswer = lastAnswer.slice(7);
const currentQuestionSelectedAnswer = currentQuestion.answers.find( const currentQuestionSelectedAnswer = currentQuestion.answers.find(
({ answerResult }) => answerResult === finalAnswer ({ answerResult }) => answerResult === finalAnswer
); );
// add current item to list of answered questions // add current item to list of answered questions
this.answeredQuestions.push( this.answeredQuestions.push(
{ {
questionText: currentQuestion.questionText, questionText: currentQuestion.questionText,
selectedAnswerText: currentQuestionSelectedAnswer.Text, selectedAnswerText: currentQuestionSelectedAnswer.Text,
} }
); );
return { return {
answerResult: finalAnswer, answerResult: finalAnswer,
answeredQuestions: this.answeredQuestions, answeredQuestions: this.answeredQuestions,
}; };
} else { } else {
const currentQuestionSelectedAnswer = currentQuestion.answers.find( const currentQuestionSelectedAnswer = currentQuestion.answers.find(
({ nextQuestionSequence }) => nextQuestionSequence === parseInt(lastAnswer) ({ nextQuestionSequence }) => nextQuestionSequence === parseInt(lastAnswer)
); );
// add current item to list of answered questions // add current item to list of answered questions
this.answeredQuestions.push( this.answeredQuestions.push(
{ {
questionText: currentQuestion.questionText, questionText: currentQuestion.questionText,
selectedAnswerText: currentQuestionSelectedAnswer.Text, selectedAnswerText: currentQuestionSelectedAnswer.Text,
} }
); );
this.currentQuestion = parseInt(lastAnswer); // update count to display next question this.currentQuestion = parseInt(lastAnswer); // update count to display next question
return false; return false;
}
} }
}
}, },
components: { components: {
buttonQuestion, buttonQuestion,