CSR-480: remove unused computeds, formatting
This commit is contained in:
parent
f1380cfe2f
commit
6164be582b
1 changed files with 37 additions and 46 deletions
|
|
@ -55,15 +55,6 @@ export default {
|
|||
questions.unshift({});
|
||||
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: {
|
||||
get: function() {
|
||||
return this.modelValue;
|
||||
|
|
@ -78,50 +69,50 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getNewModelValue(returnedAnswer) {
|
||||
if (!returnedAnswer || !Array.isArray(returnedAnswer)) { return false }
|
||||
const lastAnswer = returnedAnswer[returnedAnswer.length - 1];
|
||||
const currentQuestion = this.questions[this.currentQuestion];
|
||||
console.log('currentQuestion: ', currentQuestion)
|
||||
console.log('currentQuestion.answers: ', currentQuestion.answers)
|
||||
getNewModelValue(returnedAnswer) {
|
||||
if (!returnedAnswer || !Array.isArray(returnedAnswer)) { return false }
|
||||
const lastAnswer = returnedAnswer[returnedAnswer.length - 1];
|
||||
const currentQuestion = this.questions[this.currentQuestion];
|
||||
console.log('currentQuestion: ', currentQuestion)
|
||||
console.log('currentQuestion.answers: ', currentQuestion.answers)
|
||||
|
||||
if (lastAnswer.indexOf("answer-") === 0) {
|
||||
// if it is an answerResult
|
||||
const finalAnswer = lastAnswer.slice(7);
|
||||
if (lastAnswer.indexOf("answer-") === 0) {
|
||||
// if it is an answerResult
|
||||
const finalAnswer = lastAnswer.slice(7);
|
||||
|
||||
const currentQuestionSelectedAnswer = currentQuestion.answers.find(
|
||||
({ answerResult }) => answerResult === finalAnswer
|
||||
);
|
||||
const currentQuestionSelectedAnswer = currentQuestion.answers.find(
|
||||
({ answerResult }) => answerResult === finalAnswer
|
||||
);
|
||||
|
||||
// add current item to list of answered questions
|
||||
this.answeredQuestions.push(
|
||||
{
|
||||
questionText: currentQuestion.questionText,
|
||||
selectedAnswerText: currentQuestionSelectedAnswer.Text,
|
||||
}
|
||||
);
|
||||
// add current item to list of answered questions
|
||||
this.answeredQuestions.push(
|
||||
{
|
||||
questionText: currentQuestion.questionText,
|
||||
selectedAnswerText: currentQuestionSelectedAnswer.Text,
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
answerResult: finalAnswer,
|
||||
answeredQuestions: this.answeredQuestions,
|
||||
};
|
||||
} else {
|
||||
const currentQuestionSelectedAnswer = currentQuestion.answers.find(
|
||||
({ nextQuestionSequence }) => nextQuestionSequence === parseInt(lastAnswer)
|
||||
);
|
||||
return {
|
||||
answerResult: finalAnswer,
|
||||
answeredQuestions: this.answeredQuestions,
|
||||
};
|
||||
} else {
|
||||
const currentQuestionSelectedAnswer = currentQuestion.answers.find(
|
||||
({ nextQuestionSequence }) => nextQuestionSequence === parseInt(lastAnswer)
|
||||
);
|
||||
|
||||
// add current item to list of answered questions
|
||||
this.answeredQuestions.push(
|
||||
{
|
||||
questionText: currentQuestion.questionText,
|
||||
selectedAnswerText: currentQuestionSelectedAnswer.Text,
|
||||
}
|
||||
);
|
||||
// add current item to list of answered questions
|
||||
this.answeredQuestions.push(
|
||||
{
|
||||
questionText: currentQuestion.questionText,
|
||||
selectedAnswerText: currentQuestionSelectedAnswer.Text,
|
||||
}
|
||||
);
|
||||
|
||||
this.currentQuestion = parseInt(lastAnswer); // update count to display next question
|
||||
return false;
|
||||
}
|
||||
this.currentQuestion = parseInt(lastAnswer); // update count to display next question
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
buttonQuestion,
|
||||
|
|
|
|||
Loading…
Reference in a new issue