From 243c358422e222f36c20dce900485d0bd6e8b25f Mon Sep 17 00:00:00 2001 From: Muktazam Hasbi Ashidiqi Date: Mon, 1 Apr 2024 15:14:05 +0700 Subject: [PATCH] fix: quiz: calculate attempt --- .../presentation/bloc/quiz_exercise_cubit.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart index 0ceabed..eca50b6 100644 --- a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart +++ b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart @@ -188,9 +188,9 @@ class QuizExerciseCubit extends Cubit { } var verdict = 'INCORRECT'; - if (currentProblem.type == 'MULTIPLE_CHOICE' || - currentProblem.type == 'MULTIPLE_CHOICE_IMAGE' && - currentProblem.answer.correctAnswer.contains(answer)) { + if ((currentProblem.type == 'MULTIPLE_CHOICE' || + currentProblem.type == 'MULTIPLE_CHOICE_IMAGE') && + currentProblem.answer.correctAnswer.contains(answer)) { verdict = 'CORRECT'; } if (currentProblem.type == 'SHORT_ANSWER' && @@ -206,7 +206,7 @@ class QuizExerciseCubit extends Cubit { .where((e) => e.verdict != null && e.verdict == 'CORRECT') .length; attempt.totalIncorrect = answerList - .where((e) => e.verdict == null && e.verdict == 'INCORRECT') + .where((e) => e.verdict != null && e.verdict == 'INCORRECT') .length; toNextQuestion();