mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 22:07:10 +00:00
Merge branch 'master' of https://gitlab.prodcontest.ru/team-15/project
This commit is contained in:
@@ -42,7 +42,7 @@ class CompetitionTaskSubmissionAdmin(admin.ModelAdmin):
|
||||
"user__username",
|
||||
"user__email",
|
||||
)
|
||||
list_filter = ("plagiarism_checked", "status")
|
||||
list_filter = ("plagiarism_detected", "status")
|
||||
ordering = ["-timestamp"]
|
||||
|
||||
def has_add_permission(self, request, obj=None):
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 5.1.6 on 2025-03-03 13:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('task', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='competitiontasksubmission',
|
||||
name='plagiarism_checked',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='competitiontasksubmission',
|
||||
name='plagiarism_detected',
|
||||
field=models.BooleanField(default=False, verbose_name='обнаружен плагиат'),
|
||||
),
|
||||
]
|
||||
@@ -178,8 +178,8 @@ class CompetitionTaskSubmission(BaseModel):
|
||||
checked_at = models.DateTimeField(
|
||||
null=True, blank=True, verbose_name="дата проверки"
|
||||
)
|
||||
plagiarism_checked = models.BooleanField(
|
||||
default=False, verbose_name="проверено на плагиат"
|
||||
plagiarism_detected = models.BooleanField(
|
||||
default=False, verbose_name="обнаружен плагиат"
|
||||
)
|
||||
timestamp = models.DateTimeField(
|
||||
auto_now_add=True, verbose_name="дата отправки"
|
||||
|
||||
@@ -4,6 +4,7 @@ import httpx
|
||||
from celery import shared_task
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from apps.task.models import CompetitionTaskSubmission
|
||||
|
||||
@@ -12,10 +13,16 @@ from apps.task.models import CompetitionTaskSubmission
|
||||
def analyze_data_task(self, submission_id):
|
||||
submission = CompetitionTaskSubmission.objects.get(id=submission_id)
|
||||
try:
|
||||
code_url = f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}{submission.content.path}"
|
||||
code_url = (
|
||||
f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}/"
|
||||
f"{urlparse(submission.content.url).path}"
|
||||
)
|
||||
files = [
|
||||
{
|
||||
"url": f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}{attachment.path}",
|
||||
"url": (
|
||||
f"{settings.MINIO_DEFAULT_CUSTOM_ENDPOINT_URL}/"
|
||||
f"{urlparse(submission.content.url).path}"
|
||||
),
|
||||
"bind_path": attachment.bind_at,
|
||||
}
|
||||
for attachment in submission.task.attachments.filter(
|
||||
@@ -40,7 +47,7 @@ def analyze_data_task(self, submission_id):
|
||||
|
||||
submission.stdout.save("output.txt", ContentFile(result["output"]))
|
||||
submission.result = {
|
||||
"correct": result["hash_match"],
|
||||
"correct": result["correct"],
|
||||
"hash_match": result["hash_match"],
|
||||
"error": result.get("error"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user