Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
8bf178e9
Commit
8bf178e9
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Jobs: Lepší formát komentářů
parent
03f817a5
No related branches found
No related tags found
1 merge request
!81
Generování protokolů a zpracování scanů
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/jobs/submit.py
+28
-24
28 additions, 24 deletions
mo/jobs/submit.py
with
28 additions
and
24 deletions
mo/jobs/submit.py
+
28
−
24
View file @
8bf178e9
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment