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
4b44aeec
Commit
4b44aeec
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Při zakládání contestů kopírujeme round.state
parent
b83d8c0b
No related branches found
No related tags found
1 merge request
!49
Stavy soutěže
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/create-contests
+7
-2
7 additions, 2 deletions
bin/create-contests
mo/web/org_round.py
+8
-1
8 additions, 1 deletion
mo/web/org_round.py
with
15 additions
and
3 deletions
bin/create-contests
+
7
−
2
View file @
4b44aeec
...
...
@@ -22,6 +22,11 @@ round = mo.util.get_round_by_code(round_code)
if
round
is
None
:
die
(
"
Kolo s tímto kódem neexistuje!
"
)
if
round
.
state
!=
db
.
RoundState
.
delegate
:
state
=
round
.
state
else
:
state
=
db
.
RoundState
.
preparing
if
round
.
is_subround
():
# Pokud je to podkolo, kopírujeme soutěže z hlavního kola
for
mc
in
sess
.
query
(
db
.
Contest
).
filter_by
(
round
=
round
.
master
):
...
...
@@ -29,7 +34,7 @@ if round.is_subround():
print
(
f
"
Zakládám
{
round
.
round_code
()
}
pro místo
{
r
.
name
}
(podsoutěž)
"
)
if
not
args
.
dry_run
:
c
=
db
.
Contest
(
round
=
round
,
place
=
r
,
master
=
mc
)
c
=
db
.
Contest
(
round
=
round
,
place
=
r
,
master
=
mc
,
state
=
state
)
sess
.
add
(
c
)
sess
.
flush
()
...
...
@@ -45,7 +50,7 @@ else:
for
r
in
regions
:
print
(
f
"
Zakládám
{
round
.
round_code
()
}
pro místo
{
r
.
name
}
"
)
if
not
args
.
dry_run
:
c
=
db
.
Contest
(
round
=
round
,
place
=
r
)
c
=
db
.
Contest
(
round
=
round
,
place
=
r
,
state
=
state
)
sess
.
add
(
c
)
sess
.
flush
()
...
...
This diff is collapsed.
Click to expand it.
mo/web/org_round.py
+
8
−
1
View file @
4b44aeec
...
...
@@ -111,8 +111,14 @@ def add_contest(round: db.Round, form: AddContestForm) -> bool:
flash
(
f
'
Pro
{
place
.
type_name
()
}
{
place
.
name
}
už toto kolo existuje
'
,
'
danger
'
)
return
False
# Počáteční stav soutěže
if
round
.
state
!=
db
.
RoundState
.
delegate
:
state
=
round
.
state
else
:
state
=
db
.
RoundState
.
preparing
# Soutěž vytvoříme vždy v hlavním kole
contest
=
db
.
Contest
(
round
=
round
.
master
,
place
=
place
)
contest
=
db
.
Contest
(
round
=
round
.
master
,
place
=
place
,
state
=
state
)
rr
=
g
.
gatekeeper
.
rights_for_contest
(
contest
)
if
not
rr
.
have_right
(
Right
.
add_contest
):
flash
(
'
Vaše role nedovoluje vytvořit soutěž v oblasti {place.type_name()} {place.name}
'
,
'
danger
'
)
...
...
@@ -138,6 +144,7 @@ def add_contest(round: db.Round, form: AddContestForm) -> bool:
round_id
=
subround
.
round_id
,
master_contest_id
=
contest
.
contest_id
,
place_id
=
contest
.
place_id
,
state
=
state
,
)
sess
.
add
(
subcontest
)
sess
.
flush
()
...
...
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