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
805571f2
Commit
805571f2
authored
4 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Diplomy/sazba: Předáváme i ID výsledkové listiny, podle které vydávat
parent
5c5dcdb0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/jobs/certs.py
+13
-3
13 additions, 3 deletions
mo/jobs/certs.py
with
13 additions
and
3 deletions
mo/jobs/certs.py
+
13
−
3
View file @
805571f2
...
@@ -19,7 +19,7 @@ import mo.util_format
...
@@ -19,7 +19,7 @@ import mo.util_format
from
mo.util_tex
import
tex_arg
,
tex_key
,
run_tex
,
format_hacks
,
QREncoder
from
mo.util_tex
import
tex_arg
,
tex_key
,
run_tex
,
format_hacks
,
QREncoder
def
schedule_create_certs
(
contest
:
db
.
Contest
,
for_user
:
db
.
User
)
->
int
:
def
schedule_create_certs
(
contest
:
db
.
Contest
,
scoretable_id
:
Optional
[
int
],
for_user
:
db
.
User
)
->
int
:
place
=
contest
.
place
place
=
contest
.
place
the_job
=
TheJob
()
the_job
=
TheJob
()
...
@@ -27,6 +27,7 @@ def schedule_create_certs(contest: db.Contest, for_user: db.User) -> int:
...
@@ -27,6 +27,7 @@ def schedule_create_certs(contest: db.Contest, for_user: db.User) -> int:
job
.
description
=
f
'
Diplomy
{
contest
.
round
.
round_code
()
}
{
place
.
name_locative
()
}
'
job
.
description
=
f
'
Diplomy
{
contest
.
round
.
round_code
()
}
{
place
.
name_locative
()
}
'
job
.
in_json
=
{
job
.
in_json
=
{
'
contest_id
'
:
contest
.
contest_id
,
'
contest_id
'
:
contest
.
contest_id
,
'
scoretable_id
'
:
scoretable_id
,
}
}
the_job
.
submit
()
the_job
.
submit
()
assert
the_job
.
job_id
is
not
None
assert
the_job
.
job_id
is
not
None
...
@@ -141,18 +142,27 @@ class CertMaker:
...
@@ -141,18 +142,27 @@ class CertMaker:
walker
=
Walker
(
self
.
job
.
in_json
)
walker
=
Walker
(
self
.
job
.
in_json
)
with
walker
.
enter_object
()
as
root
:
with
walker
.
enter_object
()
as
root
:
self
.
contest_id
=
root
[
'
contest_id
'
].
as_int
()
self
.
contest_id
=
root
[
'
contest_id
'
].
as_int
()
if
root
[
'
scoretable_id
'
].
is_null
():
scoretable_id
=
None
else
:
scoretable_id
=
root
[
'
scoretable_id
'
].
as_int
()
sess
=
db
.
get_session
()
sess
=
db
.
get_session
()
self
.
contest
=
(
sess
.
query
(
db
.
Contest
)
self
.
contest
=
(
sess
.
query
(
db
.
Contest
)
.
options
(
joinedload
(
db
.
Contest
.
round
))
.
options
(
joinedload
(
db
.
Contest
.
round
))
.
options
(
joinedload
(
db
.
Contest
.
place
))
.
options
(
joinedload
(
db
.
Contest
.
place
))
.
options
(
joinedload
(
db
.
Contest
.
scoretable
))
.
get
(
self
.
contest_id
)
.
get
(
self
.
contest_id
)
)
)
assert
self
.
contest
is
not
None
assert
self
.
contest
is
not
None
self
.
round
=
self
.
contest
.
round
self
.
round
=
self
.
contest
.
round
self
.
place
=
self
.
contest
.
place
self
.
place
=
self
.
contest
.
place
self
.
scoretable
=
self
.
contest
.
scoretable
logger
.
info
(
f
'
{
self
.
the_job
.
log_prefix
}
Vytvářím certifikáty pro soutěž #
{
self
.
contest
.
contest_id
}
s výsledkovou listinou #
{
scoretable_id
}
'
)
if
scoretable_id
is
not
None
:
self
.
scoretable
=
sess
.
query
(
db
.
ScoreTable
).
get
(
scoretable_id
)
assert
self
.
scoretable
is
not
None
else
:
self
.
scoretable
=
None
self
.
cset
=
sess
.
query
(
db
.
CertSet
).
get
(
self
.
contest_id
)
self
.
cset
=
sess
.
query
(
db
.
CertSet
).
get
(
self
.
contest_id
)
assert
self
.
cset
is
not
None
assert
self
.
cset
is
not
None
...
...
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