From 1a23cefa1a5ff1075b4a2e526b6eeb1901e260e3 Mon Sep 17 00:00:00 2001 From: ITQ Date: Mon, 3 Mar 2025 15:47:20 +0300 Subject: [PATCH] (scope): [body] [footer(s)] --- services/backend/api/v1/task/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/services/backend/api/v1/task/views.py b/services/backend/api/v1/task/views.py index d34d88e..f2e93c9 100644 --- a/services/backend/api/v1/task/views.py +++ b/services/backend/api/v1/task/views.py @@ -109,7 +109,9 @@ def submit_task( user=user, achievement=first_steps_achievement ) - total_attempts = CompetitionTaskSubmission.objects.filter(user=user, task=task).count() + total_attempts = CompetitionTaskSubmission.objects.filter( + user=user, task=task + ).count() if task.max_attempts == total_attempts: return status.FORBIDDEN, ForbiddenError() @@ -118,8 +120,10 @@ def submit_task( user=user, task=task, status=CompetitionTaskSubmission.StatusChoices.CHECKED, - result={"correct": content == task.answer_file_path}, content=content, + result={ + "correct": content.read() == task.correct_answer_file.read() + }, ) if task.type == CompetitionTask.CompetitionTaskType.REVIEW: submission = CompetitionTaskSubmission.objects.create(