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
64acbb53
Commit
64acbb53
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Delegace v db.py
parent
95e8f42b
No related branches found
No related tags found
1 merge request
!49
Stavy soutěže
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/db.py
+10
-0
10 additions, 0 deletions
mo/db.py
with
10 additions
and
0 deletions
mo/db.py
+
10
−
0
View file @
64acbb53
...
@@ -157,6 +157,7 @@ class RoundState(MOEnum):
...
@@ -157,6 +157,7 @@ class RoundState(MOEnum):
running
=
auto
()
running
=
auto
()
grading
=
auto
()
grading
=
auto
()
closed
=
auto
()
closed
=
auto
()
delegate
=
auto
()
def
friendly_name
(
self
)
->
str
:
def
friendly_name
(
self
)
->
str
:
return
round_state_names
[
self
]
return
round_state_names
[
self
]
...
@@ -167,6 +168,7 @@ round_state_names = {
...
@@ -167,6 +168,7 @@ round_state_names = {
RoundState
.
running
:
'
běží
'
,
RoundState
.
running
:
'
běží
'
,
RoundState
.
grading
:
'
opravuje se
'
,
RoundState
.
grading
:
'
opravuje se
'
,
RoundState
.
closed
:
'
ukončeno
'
,
RoundState
.
closed
:
'
ukončeno
'
,
RoundState
.
delegate
:
'
po oblastech
'
,
}
}
...
@@ -305,6 +307,7 @@ class Contest(Base):
...
@@ -305,6 +307,7 @@ class Contest(Base):
master_contest_id
=
Column
(
Integer
,
ForeignKey
(
'
contests.contest_id
'
))
master_contest_id
=
Column
(
Integer
,
ForeignKey
(
'
contests.contest_id
'
))
round_id
=
Column
(
Integer
,
ForeignKey
(
'
rounds.round_id
'
),
nullable
=
False
)
round_id
=
Column
(
Integer
,
ForeignKey
(
'
rounds.round_id
'
),
nullable
=
False
)
place_id
=
Column
(
Integer
,
ForeignKey
(
'
places.place_id
'
),
nullable
=
False
)
place_id
=
Column
(
Integer
,
ForeignKey
(
'
places.place_id
'
),
nullable
=
False
)
state
=
Column
(
Enum
(
RoundState
,
name
=
'
round_state
'
),
nullable
=
False
,
server_default
=
text
(
"'
preparing
'
::round_state
"
))
master
=
relationship
(
'
Contest
'
,
primaryjoin
=
'
Contest.master_contest_id == Contest.contest_id
'
,
remote_side
=
'
Contest.contest_id
'
,
post_update
=
True
)
master
=
relationship
(
'
Contest
'
,
primaryjoin
=
'
Contest.master_contest_id == Contest.contest_id
'
,
remote_side
=
'
Contest.contest_id
'
,
post_update
=
True
)
place
=
relationship
(
'
Place
'
)
place
=
relationship
(
'
Place
'
)
...
@@ -320,6 +323,13 @@ class Contest(Base):
...
@@ -320,6 +323,13 @@ class Contest(Base):
add_self
or
Contest
.
contest_id
!=
self
.
contest_id
,
add_self
or
Contest
.
contest_id
!=
self
.
contest_id
,
).
options
(
joinedload
(
Contest
.
round
)).
all
()
).
options
(
joinedload
(
Contest
.
round
)).
all
()
def
get_state
(
self
):
if
self
.
round
.
state
!=
RoundState
.
delegate
:
return
self
.
round
.
state
else
:
return
self
.
state
class
LogType
(
MOEnum
):
class
LogType
(
MOEnum
):
general
=
auto
()
general
=
auto
()
user
=
auto
()
user
=
auto
()
...
...
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