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
702a9a20
Commit
702a9a20
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Zavedení custom kódu kola
parent
a3e9e7a6
Branches
Branches containing commit
No related tags found
1 merge request
!99
Custom kód kola
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/db.ddl
+1
-0
1 addition, 0 deletions
db/db.ddl
db/upgrade-20210929.sql
+4
-0
4 additions, 0 deletions
db/upgrade-20210929.sql
mo/db.py
+2
-1
2 additions, 1 deletion
mo/db.py
with
7 additions
and
1 deletion
db/db.ddl
+
1
−
0
View file @
702a9a20
...
...
@@ -115,6 +115,7 @@ CREATE TABLE rounds (
seq int NOT NULL, -- 1=domácí kolo atd.
part int NOT NULL DEFAULT 0, -- část kola (nenulová u dělených kol)
level int NOT NULL, -- úroveň hierarchie míst
code varchar(255) NOT NULL DEFAULT '', -- kód kola ("1", "S" apod.), prázdný=podle seq
name varchar(255) NOT NULL, -- zobrazované jméno ("Krajské kolo" apod.)
state round_state NOT NULL DEFAULT 'preparing', -- stav kola
tasks_file varchar(255) DEFAULT NULL, -- jméno souboru se zadáním úloh
...
...
This diff is collapsed.
Click to expand it.
db/upgrade-20210929.sql
0 → 100644
+
4
−
0
View file @
702a9a20
SET
ROLE
'mo_osmo'
;
ALTER
TABLE
ROUNDS
ADD
COLUMN
code
varchar
(
255
)
NOT
NULL
DEFAULT
''
;
This diff is collapsed.
Click to expand it.
mo/db.py
+
2
−
1
View file @
702a9a20
...
...
@@ -249,6 +249,7 @@ class Round(Base):
seq
=
Column
(
Integer
,
nullable
=
False
)
part
=
Column
(
Integer
,
nullable
=
False
)
level
=
Column
(
Integer
,
nullable
=
False
)
code
=
Column
(
String
(
255
),
nullable
=
False
)
name
=
Column
(
String
(
255
),
nullable
=
False
)
state
=
Column
(
Enum
(
RoundState
,
name
=
'
round_state
'
),
nullable
=
False
,
server_default
=
text
(
"'
preparing
'
::round_state
"
))
tasks_file
=
Column
(
String
(
255
))
...
...
@@ -268,7 +269,7 @@ class Round(Base):
def
round_code_short
(
self
):
"""
Pro samostatné kolo ekvivalentní s `round_code()`, pro skupinu kol společná část kódu.
"""
return
f
"
{
self
.
year
}
-
{
self
.
category
}
-
{
self
.
seq
}
"
return
f
"
{
self
.
year
}
-
{
self
.
category
}
-
{
self
.
code
or
self
.
seq
}
"
def
part_code
(
self
):
return
chr
(
ord
(
'
a
'
)
+
self
.
part
-
1
)
if
self
.
part
>
0
else
""
...
...
This diff is collapsed.
Click to expand it.
Martin Mareš
@mj
mentioned in commit
1d7827bb
·
2 years ago
mentioned in commit
1d7827bb
mentioned in commit 1d7827bb7a1357a2fa488d4a117e4e054a1fad59
Toggle commit list
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