mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 13:17:10 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -35,7 +35,7 @@ class CompetitionEndpointTests(TestCase):
|
||||
self.valid_headers = {"HTTP_AUTHORIZATION": f"Bearer {token}"}
|
||||
|
||||
def get_url(self, competition_id):
|
||||
return f"/api/v1/competition/{competition_id}"
|
||||
return f"/api/v1/competitions/{competition_id}"
|
||||
|
||||
def test_get_competition_success(self):
|
||||
response = self.client.get(
|
||||
|
||||
@@ -31,7 +31,7 @@ class CompetitionTaskSubmissionAdmin(admin.ModelAdmin):
|
||||
"user__username",
|
||||
"user__email",
|
||||
)
|
||||
filter = ("plagiarism_checked",)
|
||||
list_filter = ("plagiarism_checked", "status",)
|
||||
ordering = ["-timestamp"]
|
||||
|
||||
def has_add_permission(self, request, obj=None):
|
||||
|
||||
@@ -92,9 +92,9 @@ class CompetitionTaskAttachment(BaseModel):
|
||||
|
||||
class CompetitionTaskSubmission(BaseModel):
|
||||
class StatusChoices(models.TextChoices):
|
||||
SENT = "sent"
|
||||
CHECKING = "checking"
|
||||
CHECKED = "checked"
|
||||
SENT = "sent", "Отправлено на проверку"
|
||||
CHECKING = "checking", "Проверка"
|
||||
CHECKED = "checked", "Проверено"
|
||||
|
||||
def submission_content_upload_to(instance, filename) -> str:
|
||||
return f"submissions/{instance.id}/content/{filename}"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import requests
|
||||
import httpx
|
||||
from celery import shared_task
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
@@ -17,7 +17,7 @@ def analyze_data_task(self, submission_id):
|
||||
for f in submission.task.attachments.filter(public=True)
|
||||
]
|
||||
|
||||
response = requests.post(
|
||||
response = httpx.post(
|
||||
f"{settings.CHECKER_API_ENDPOINT}/execute",
|
||||
files=[("files", (f.name, f)) for f in files]
|
||||
+ [
|
||||
@@ -40,10 +40,10 @@ def analyze_data_task(self, submission_id):
|
||||
)
|
||||
submission.status = CompetitionTaskSubmission.StatusChoices.CHECKED
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
except httpx.RequestError as e:
|
||||
self.retry(countdown=2**self.request.retries)
|
||||
except Exception as e:
|
||||
submission.result = {"error": str(e)}
|
||||
submission.result = {"error": str(e), "success": False}
|
||||
submission.status = CompetitionTaskSubmission.StatusChoices.CHECKED
|
||||
submission.earned_points = 0
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user