mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 02:47:10 +00:00
Merge branch 'master' of https://gitlab.prodcontest.ru/team-15/project
This commit is contained in:
@@ -41,7 +41,7 @@ http_addr =
|
||||
http_port = 3000
|
||||
|
||||
# The public facing domain name used to access grafana from a browser
|
||||
domain = prod-team-15-2pc0i3lc.final.prodcontest.ru
|
||||
domain = localhost
|
||||
|
||||
# Redirect to correct domain if host header does not match domain
|
||||
# Prevents DNS rebinding attacks
|
||||
|
||||
@@ -109,17 +109,23 @@ 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()
|
||||
|
||||
if task.type == CompetitionTask.CompetitionTaskType.INPUT:
|
||||
verdict = content.read() == task.correct_answer_file.read()
|
||||
submission = CompetitionTaskSubmission.objects.create(
|
||||
user=user,
|
||||
task=task,
|
||||
status=CompetitionTaskSubmission.StatusChoices.CHECKED,
|
||||
result={"correct": content == task.answer_file_path},
|
||||
content=content,
|
||||
result={
|
||||
"correct": verdict
|
||||
},
|
||||
earned_points=task.points
|
||||
)
|
||||
if task.type == CompetitionTask.CompetitionTaskType.REVIEW:
|
||||
submission = CompetitionTaskSubmission.objects.create(
|
||||
|
||||
@@ -4,7 +4,7 @@ from datetime import timedelta, datetime
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.files.base import ContentFile, File
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
@@ -229,12 +229,12 @@ reviewers = [
|
||||
{
|
||||
"name": "Владислав",
|
||||
"surname": "Пикиневич",
|
||||
"token": "pikinevich"
|
||||
"token": "aa443163-9861-4b8d-b8f7-81ecd25f6088"
|
||||
},
|
||||
{
|
||||
"name": "Александр",
|
||||
"surname": "Шахов",
|
||||
"token": "ashakhov"
|
||||
"token": "d2e8904a-01dd-4f84-a8b0-8a60f1a3b6c0"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -357,7 +357,8 @@ class Command(BaseCommand):
|
||||
|
||||
content_dir = f"{settings.BASE_DIR}/apps/core/contents"
|
||||
with open(f"{content_dir}/presentation.pptx", "rb") as f:
|
||||
files = [f, f, dummy_content_txt]
|
||||
pptx = File(f, name="presentation.pptx")
|
||||
files = [pptx, pptx, dummy_content_txt]
|
||||
submission = CompetitionTaskSubmission.objects.create(
|
||||
user=user,
|
||||
task=task,
|
||||
|
||||
@@ -41,11 +41,11 @@ def analyze_data_task(self, submission_id):
|
||||
submission.stdout.save("output.txt", ContentFile(result["output"]))
|
||||
submission.result = {
|
||||
"correct": result["hash_match"],
|
||||
"result_hash": result["result_hash"],
|
||||
"hash_match": result["hash_match"],
|
||||
"error": result.get("error"),
|
||||
}
|
||||
submission.earned_points = (
|
||||
submission.task.points if result["hash_match"] else 0
|
||||
submission.task.points if result["correct"] else 0
|
||||
)
|
||||
submission.status = CompetitionTaskSubmission.StatusChoices.CHECKED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user