mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-06-10 06:52:33 +00:00
Merge branch 'master' of gitlab.prodcontest.ru:team-15/project
This commit is contained in:
@@ -24,6 +24,6 @@ FROM docker.io/nginx:latest
|
|||||||
|
|
||||||
COPY --from=builder /app/static /usr/share/nginx/html
|
COPY --from=builder /app/static /usr/share/nginx/html
|
||||||
|
|
||||||
COPY ../checker/checker_requirements.txt .
|
COPY ../checker/checker_requirements.txt /usr/share/nginx/html
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ B — пользователи, которым доступен только о
|
|||||||
""".strip(),
|
""".strip(),
|
||||||
"type": CompetitionTask.CompetitionTaskType.INPUT.value,
|
"type": CompetitionTask.CompetitionTaskType.INPUT.value,
|
||||||
"points": 15,
|
"points": 15,
|
||||||
"submission_reviewers_count": 2,
|
|
||||||
"max_attempts": 50,
|
"max_attempts": 50,
|
||||||
"correct_answer_file": ans3,
|
"correct_answer_file": ans3,
|
||||||
},
|
},
|
||||||
@@ -434,7 +433,6 @@ B — пользователи, которым доступен только о
|
|||||||
"description": "Сколько будет 6 * 7?",
|
"description": "Сколько будет 6 * 7?",
|
||||||
"type": CompetitionTask.CompetitionTaskType.INPUT.value,
|
"type": CompetitionTask.CompetitionTaskType.INPUT.value,
|
||||||
"points": 5,
|
"points": 5,
|
||||||
"submission_reviewers_count": 2,
|
|
||||||
"max_attempts": 10,
|
"max_attempts": 10,
|
||||||
"correct_answer_file": ans3,
|
"correct_answer_file": ans3,
|
||||||
},
|
},
|
||||||
@@ -522,8 +520,8 @@ users = [
|
|||||||
"role": UserRole.STUDENT.value,
|
"role": UserRole.STUDENT.value,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"email": "oleg-tinkov@gmail.com",
|
"email": "s.bliznyuk@tbank.ru",
|
||||||
"username": "oleg-tinkov",
|
"username": "s_bliznyuk",
|
||||||
"password": "password123!",
|
"password": "password123!",
|
||||||
"role": UserRole.STUDENT.value,
|
"role": UserRole.STUDENT.value,
|
||||||
},
|
},
|
||||||
@@ -659,14 +657,17 @@ class Command(BaseCommand):
|
|||||||
competitions_objs = []
|
competitions_objs = []
|
||||||
|
|
||||||
for i, competition in enumerate(competitions):
|
for i, competition in enumerate(competitions):
|
||||||
competition_obj = Competition.objects.create(
|
try:
|
||||||
title=competition["title"],
|
competition_obj = Competition.objects.create(
|
||||||
description=competition["description"],
|
title=competition["title"],
|
||||||
start_date=competition["start_date"],
|
description=competition["description"],
|
||||||
end_date=competition["end_date"],
|
start_date=competition["start_date"],
|
||||||
type=competition["type"],
|
end_date=competition["end_date"],
|
||||||
participation_type=competition["participation_type"],
|
type=competition["type"],
|
||||||
)
|
participation_type=competition["participation_type"],
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
print(competition)
|
||||||
|
|
||||||
if competition.get("image"):
|
if competition.get("image"):
|
||||||
competition_obj.image_url = competition["image"]
|
competition_obj.image_url = competition["image"]
|
||||||
@@ -696,16 +697,13 @@ class Command(BaseCommand):
|
|||||||
points=task["points"],
|
points=task["points"],
|
||||||
submission_reviewers_count=task[
|
submission_reviewers_count=task[
|
||||||
"submission_reviewers_count"
|
"submission_reviewers_count"
|
||||||
],
|
] if task["type"] == CompetitionTask.CompetitionTaskType.REVIEW.value else None,
|
||||||
|
correct_answer_file=task["correct_answer_file"] if task["type"] != CompetitionTask.CompetitionTaskType.REVIEW.value else None,
|
||||||
max_attempts=task.get("max_attempts"),
|
max_attempts=task.get("max_attempts"),
|
||||||
)
|
)
|
||||||
competitions[i]["tasks"][j]["obj"] = task_obj
|
competitions[i]["tasks"][j]["obj"] = task_obj
|
||||||
|
|
||||||
if (
|
|
||||||
task["type"]
|
|
||||||
== CompetitionTask.CompetitionTaskType.INPUT.value
|
|
||||||
):
|
|
||||||
task_obj.correct_answer_file = task["correct_answer_file"]
|
|
||||||
if task.get("attachment"):
|
if task.get("attachment"):
|
||||||
CompetitionTaskAttachment.objects.create(
|
CompetitionTaskAttachment.objects.create(
|
||||||
task=task_obj,
|
task=task_obj,
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CompetitionTask(BaseModel):
|
|||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
"correct_answer_file": "Загрузите правильный ответ"
|
"correct_answer_file": "Загрузите правильный ответ"
|
||||||
})
|
})
|
||||||
|
|
||||||
# if self.answer_file_path and not self.type == "checker":
|
# if self.answer_file_path and not self.type == "checker":
|
||||||
# raise ValidationError({
|
# raise ValidationError({
|
||||||
# "type": "Укажите другой тип задания: этот не совместим с путем правильного ответа"
|
# "type": "Укажите другой тип задания: этот не совместим с путем правильного ответа"
|
||||||
@@ -100,7 +100,7 @@ class CompetitionTask(BaseModel):
|
|||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
"answer_file_path": "Введите путь правильного ответа - это нужно для корректной работы чекера"
|
"answer_file_path": "Введите путь правильного ответа - это нужно для корректной работы чекера"
|
||||||
})
|
})
|
||||||
|
|
||||||
if not self.reviewers and self.type == "review":
|
if not self.reviewers and self.type == "review":
|
||||||
raise ValidationError({
|
raise ValidationError({
|
||||||
"reviewers": "Загрузите ревьюверов - кто будет проверять задания, если не они?"
|
"reviewers": "Загрузите ревьюверов - кто будет проверять задания, если не они?"
|
||||||
@@ -110,7 +110,6 @@ class CompetitionTask(BaseModel):
|
|||||||
# "type": "Проверьте тип - вы ввели ревьюверов, но задание не является ручным"
|
# "type": "Проверьте тип - вы ввели ревьюверов, но задание не является ручным"
|
||||||
# })
|
# })
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
@@ -150,9 +149,16 @@ class CompetitionTaskAttachment(BaseModel):
|
|||||||
related_name="attachments",
|
related_name="attachments",
|
||||||
)
|
)
|
||||||
file = models.FileField(upload_to=file_upload_at, verbose_name="файл")
|
file = models.FileField(upload_to=file_upload_at, verbose_name="файл")
|
||||||
bind_at = models.CharField(verbose_name="путь сохранения", max_length=255,
|
bind_at = models.CharField(
|
||||||
validators=[RegexValidator(r"^(?:[a-zA-Z]:\\(?:[^<>:\"\/\\|?*]*\\)*|/(?:[^<>:\"\/\\|?*]+/?)*)$",
|
verbose_name="путь сохранения",
|
||||||
message="Введите абсолютный путь до папки")])
|
max_length=255,
|
||||||
|
validators=[
|
||||||
|
RegexValidator(
|
||||||
|
r"^(?:[a-zA-Z]:\\(?:[^<>:\"\/\\|?*]*\\)*|/(?:[^<>:\"\/\\|?*]+/?)*)$",
|
||||||
|
message="Введите абсолютный путь до папки",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
public = models.BooleanField(default=False, verbose_name="публичный")
|
public = models.BooleanField(default=False, verbose_name="публичный")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def analyze_data_task(self, submission_id):
|
|||||||
"code": base64.b64encode(code).decode("utf-8"),
|
"code": base64.b64encode(code).decode("utf-8"),
|
||||||
"answer_file_path": submission.task.answer_file_path,
|
"answer_file_path": submission.task.answer_file_path,
|
||||||
"expected_hash": hashlib.sha256(
|
"expected_hash": hashlib.sha256(
|
||||||
submission.task.correct_answer_file.read()
|
submission.task.correct_answer_file.read().decode("utf-8")
|
||||||
).hexdigest(),
|
).hexdigest(),
|
||||||
},
|
},
|
||||||
timeout=30,
|
timeout=30,
|
||||||
|
|||||||
Reference in New Issue
Block a user