is_passed

This commit is contained in:
cja committed 2025-05-28 10:14:25 +03:00
1 parent 86a44eb5ae
commit b5fef273ee
1 file changed
+3 -2
+3 -2
View File
@@ -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,