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
bd8d30f6
Commit
bd8d30f6
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Dělená kola: vytváření soutěží vždy v hlavním kole
parent
85963701
Branches
Branches containing commit
No related tags found
1 merge request
!48
Dělená kola napotřetí
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/org_round.py
+27
-5
27 additions, 5 deletions
mo/web/org_round.py
mo/web/templates/org_rounds.html
+1
-1
1 addition, 1 deletion
mo/web/templates/org_rounds.html
with
28 additions
and
6 deletions
mo/web/org_round.py
+
27
−
5
View file @
bd8d30f6
...
...
@@ -102,16 +102,17 @@ def add_contest(round: db.Round, form: AddContestForm) -> bool:
flash
(
f
'
Místo s kódem
{
form
.
place_code
.
data
}
neexistuje
'
,
'
danger
'
)
return
False
if
place
.
level
!=
round
.
level
:
flash
(
f
'
{
place
.
type_name
().
title
()
}
{
place
.
name
}
není
{
db
.
place_level_names
[
round
.
level
]
}
'
,
'
danger
'
)
return
False
#
if place.level != round.level:
#
flash(f'{place.type_name().title()} {place.name} není {db.place_level_names[round.level]}', 'danger')
#
return False
sess
=
db
.
get_session
()
if
sess
.
query
(
db
.
Contest
).
filter_by
(
round
=
round
,
place
=
place
).
one_or_none
():
flash
(
f
'
Pro
{
place
.
type_name
()
}
{
place
.
name
}
už toto kolo existuje
'
,
'
danger
'
)
return
False
contest
=
db
.
Contest
(
round
=
round
,
place
=
place
)
# Soutěž vytvoříme vždy v hlavním kole
contest
=
db
.
Contest
(
round
=
round
.
master
,
place
=
place
)
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
'
)
...
...
@@ -119,6 +120,9 @@ def add_contest(round: db.Round, form: AddContestForm) -> bool:
sess
.
add
(
contest
)
sess
.
flush
()
contest
.
master_contest_id
=
contest
.
contest_id
sess
.
add
(
contest
)
sess
.
flush
()
mo
.
util
.
log
(
type
=
db
.
LogType
.
contest
,
...
...
@@ -126,8 +130,26 @@ def add_contest(round: db.Round, form: AddContestForm) -> bool:
details
=
{
'
action
'
:
'
add
'
,
'
contest
'
:
db
.
row2dict
(
contest
)},
)
app
.
logger
.
info
(
f
"
Soutěž #
{
contest
.
contest_id
}
založena:
{
db
.
row2dict
(
contest
)
}
"
)
sess
.
commit
()
# Přidání soutěže do podkol ve skupině
subrounds
=
round
.
master
.
get_group_rounds
()
for
subround
in
subrounds
:
subcontest
=
db
.
Contest
(
round_id
=
subround
.
round_id
,
master_contest_id
=
contest
.
contest_id
,
place_id
=
contest
.
place_id
,
)
sess
.
add
(
subcontest
)
sess
.
flush
()
mo
.
util
.
log
(
type
=
db
.
LogType
.
contest
,
what
=
subcontest
.
contest_id
,
details
=
{
'
action
'
:
'
add
'
,
'
contest
'
:
db
.
row2dict
(
subcontest
)},
)
app
.
logger
.
info
(
f
"
Soutěž #
{
subcontest
.
contest_id
}
založena:
{
db
.
row2dict
(
subcontest
)
}
"
)
sess
.
commit
()
flash
(
f
'
Soutěž v oblasti
{
place
.
type_name
()
}
{
place
.
name
}
založena
'
,
'
success
'
)
return
True
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_rounds.html
+
1
−
1
View file @
bd8d30f6
...
...
@@ -17,7 +17,7 @@
<td><a
href=
'{{ url_for('
org_round
',
id=
r.round_id)
}}'
>
{{ r.round_code() }}
</a>
<td>
{{ r.year }}
<td>
{{ r.category }}
<td>
{{ r.seq }}
<td>
{{ r.seq }}
{{ r.part_code() }}
<td>
{{ level_names[r.level] }}
<td>
{{ r.name }}
<td
class=
'rstate-{{r.state.name}}'
>
{{ r.state.friendly_name() }}
...
...
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