diff --git a/src/back/tests/views.py b/src/back/tests/views.py index ae6f98c52..df18d408c 100644 --- a/src/back/tests/views.py +++ b/src/back/tests/views.py @@ -355,7 +355,8 @@ class TestResultView(generics.ListCreateAPIView): self.update_testing(user, test_info) return Response(data={'score': test_info['score'], - 'answered_questions_total': test_info['answered_questions_total']}) + 'answered_questions_total': test_info['answered_questions_total'], + 'is_passed': test_info['is_passed']}) def create_test_attempt(self, user, test_info): """Creates a new test attempt for the user.""" @@ -396,7 +397,7 @@ class TestResultView(generics.ListCreateAPIView): pass_perc = test_answers[0].question.test.pass_perc result = { - "is_passed": correct_questions >= pass_perc, + "is_passed": (correct_questions/answered_questions_total*100) >= pass_perc, "score": correct_questions, "test": test, "answered_questions_total": answered_questions_total,