mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 01:37:11 +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__username",
|
||||||
"user__email",
|
"user__email",
|
||||||
)
|
)
|
||||||
list_filter = ("plagiarism_checked", "status")
|
list_filter = ("plagiarism_detected", "status")
|
||||||
ordering = ["-timestamp"]
|
ordering = ["-timestamp"]
|
||||||
|
|
||||||
def has_add_permission(self, request, obj=None):
|
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(
|
checked_at = models.DateTimeField(
|
||||||
null=True, blank=True, verbose_name="дата проверки"
|
null=True, blank=True, verbose_name="дата проверки"
|
||||||
)
|
)
|
||||||
plagiarism_checked = models.BooleanField(
|
plagiarism_detected = models.BooleanField(
|
||||||
default=False, verbose_name="проверено на плагиат"
|
default=False, verbose_name="обнаружен плагиат"
|
||||||
)
|
)
|
||||||
timestamp = models.DateTimeField(
|
timestamp = models.DateTimeField(
|
||||||
auto_now_add=True, verbose_name="дата отправки"
|
auto_now_add=True, verbose_name="дата отправки"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import httpx
|
|||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from apps.task.models import CompetitionTaskSubmission
|
from apps.task.models import CompetitionTaskSubmission
|
||||||
|
|
||||||
@@ -12,10 +13,16 @@ from apps.task.models import CompetitionTaskSubmission
|
|||||||
def analyze_data_task(self, submission_id):
|
def analyze_data_task(self, submission_id):
|
||||||
submission = CompetitionTaskSubmission.objects.get(id=submission_id)
|
submission = CompetitionTaskSubmission.objects.get(id=submission_id)
|
||||||
try:
|
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 = [
|
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,
|
"bind_path": attachment.bind_at,
|
||||||
}
|
}
|
||||||
for attachment in submission.task.attachments.filter(
|
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.stdout.save("output.txt", ContentFile(result["output"]))
|
||||||
submission.result = {
|
submission.result = {
|
||||||
"correct": result["hash_match"],
|
"correct": result["correct"],
|
||||||
"hash_match": result["hash_match"],
|
"hash_match": result["hash_match"],
|
||||||
"error": result.get("error"),
|
"error": result.get("error"),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user