Skip to content
Snippets Groups Projects
Commit 9e31842f authored by Martin Mareš's avatar Martin Mareš
Browse files

Jobs: Lepší formát komentářů

parent 27587d16
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !81. Comments created here will be created in the context of that merge request.
...@@ -19,6 +19,19 @@ from mo.util import logger, data_dir ...@@ -19,6 +19,19 @@ from mo.util import logger, data_dir
from mo.util_format import inflect_number, inflect_by_number, data_size from mo.util_format import inflect_number, inflect_by_number, data_size
#
# Job download_submits: Zazipuje vybrané papíry
#
# Vstupní JSON:
# { 'papers': [ seznam paper_id ke stažení ],
# 'want_feedback': true/false,
# }
#
# Výstupní JSON:
# null
#
def schedule_download_submits(paper_ids: List[int], description: str, for_user: db.User, want_subdirs: bool): def schedule_download_submits(paper_ids: List[int], description: str, for_user: db.User, want_subdirs: bool):
the_job = TheJob() the_job = TheJob()
job = the_job.create(db.JobType.download_submits, for_user) job = the_job.create(db.JobType.download_submits, for_user)
...@@ -29,17 +42,6 @@ def schedule_download_submits(paper_ids: List[int], description: str, for_user: ...@@ -29,17 +42,6 @@ def schedule_download_submits(paper_ids: List[int], description: str, for_user:
@job_handler(db.JobType.download_submits) @job_handler(db.JobType.download_submits)
def handle_download_submits(the_job: TheJob): def handle_download_submits(the_job: TheJob):
"""Zazipuje zadané papíry.
Vstupní JSON:
{ 'papers': [ seznam paper_id ke stažení ],
'want_feedback': true/false,
}
Výstupní JSON:
null
"""
job = the_job.job job = the_job.job
assert job.in_json is not None assert job.in_json is not None
ids: List[int] = job.in_json['papers'] # type: ignore ids: List[int] = job.in_json['papers'] # type: ignore
...@@ -82,6 +84,21 @@ def handle_download_submits(the_job: TheJob): ...@@ -82,6 +84,21 @@ def handle_download_submits(the_job: TheJob):
temp_file.close() temp_file.close()
#
# Job upload_feedback: Uploaduje opravená řešení
#
# Vstupní JSON:
# { 'round_id': <id>,
# 'only_task_id': <id_or_null>,
# 'only_contest_id': <id_or_null>,
# 'only_site_id': <id_or_null>,
# }
#
# Výstupní JSON:
# null
#
def schedule_upload_feedback(round: db.Round, tmp_file: str, description: str, for_user: db.User, def schedule_upload_feedback(round: db.Round, tmp_file: str, description: str, for_user: db.User,
only_contest: Optional[db.Contest], only_contest: Optional[db.Contest],
only_site: Optional[db.Place], only_site: Optional[db.Place],
...@@ -148,19 +165,6 @@ def parse_feedback_name(name: str) -> Optional[UploadFeedback]: ...@@ -148,19 +165,6 @@ def parse_feedback_name(name: str) -> Optional[UploadFeedback]:
@job_handler(db.JobType.upload_feedback) @job_handler(db.JobType.upload_feedback)
def handle_upload_feedback(the_job: TheJob): def handle_upload_feedback(the_job: TheJob):
"""Uploaduje opravená řešení.
Vstupní JSON:
{ 'round_id': <id>,
'only_task_id': <id_or_null>,
'only_contest_id': <id_or_null>,
'only_site_id': <id_or_null>,
}
Výstupní JSON:
null
"""
job = the_job.job job = the_job.job
assert job.in_file is not None assert job.in_file is not None
in_json = job.in_json in_json = job.in_json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment