chore [P-01]: подтянул бэк
This commit is contained in:
commit
562500a476
1 file changed
+4
-2
@@ -339,13 +339,15 @@ class TestResultView(generics.ListCreateAPIView):
|
|||||||
# user = User.objects.get(username = "9966-00-125")
|
# user = User.objects.get(username = "9966-00-125")
|
||||||
test_id = request.GET.get('id')
|
test_id = request.GET.get('id')
|
||||||
last_attempt = TestAttempt.objects.filter(testing__user=user,
|
last_attempt = TestAttempt.objects.filter(testing__user=user,
|
||||||
testing__test__id=test_id
|
testing__test__id=test_id,
|
||||||
|
testing__is_active=True,
|
||||||
).order_by('-completion_date').first()
|
).order_by('-completion_date').first()
|
||||||
answer_ids = TestResult.objects.filter(attempt=last_attempt
|
answer_ids = TestResult.objects.filter(attempt=last_attempt
|
||||||
).values_list('answer__id', flat=True)
|
).values_list('answer__id', flat=True)
|
||||||
test_info = self.get_test_info(answer_ids, test_id)
|
test_info = self.get_test_info(answer_ids, test_id)
|
||||||
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']})
|
||||||
|
|
||||||
@swagger_auto_schema(
|
@swagger_auto_schema(
|
||||||
operation_description=""" Сохранить результаты тестов
|
operation_description=""" Сохранить результаты тестов
|
||||||
|
|||||||
Reference in new issue
Block a user