For the multiple-answer questions, ALL of the correct answers should be selected in order for the score to increase, not just one correct answer. If one correct answer is selected and then the next answer is marked as incorrect, the score still increases by 1; it should increase only when all of the correct answers are given... If one incorrect answer is given and then all correct answers, then the score should also increase OR if a correct answer, followed by an incorrect and then a correct answer, the score should increase. Also the single-answer questions should increase score as expected. Please could you help to fix this issue. See my app here: https://stackblitz.com/edit/angular-10-quiz-app
Current code snippet for increasing score (in src -> app -> containers -> quiz -> quiz.component.ts -> checkIfAnsweredCorrectly()):
checkIfAnsweredCorrectly() {
if (this.question) {
const correctAnswerFound = this.answers.find((answer) => {
return this.question.options &&
this.question.options[answer] &&
this.question.options[answer]['selected'] &&
this.question.options[answer]['correct'];
});
const answers = this.answers && this.answers.length > 0 ? this.answers.map((answer) => answer + 1) : [];
this.quizService.userAnswers.push(this.answers && this.answers.length > 0 ? answers : this.answers);
if (correctAnswerFound > -1 &&
answers.length === this.quizService.numberOfCorrectAnswers) {
this.sendCorrectCountToQuizService(this.correctCount + 1);
}
}
}