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) self.update_testing(user, test_info)
return Response(data={'score': test_info['score'], 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): def create_test_attempt(self, user, test_info):
"""Creates a new test attempt for the user.""" """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 pass_perc = test_answers[0].question.test.pass_perc
result = { result = {
"is_passed": correct_questions >= pass_perc, "is_passed": (correct_questions/answered_questions_total*100) >= pass_perc,
"score": correct_questions, "score": correct_questions,
"test": test, "test": test,
"answered_questions_total": answered_questions_total, "answered_questions_total": answered_questions_total,