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
c4f1f608
Commit
c4f1f608
authored
3 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Úloha má typ
parent
62609c8f
No related branches found
No related tags found
1 merge request
!98
Praktické úlohy a propojení s CMS
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/db.ddl
+8
-1
8 additions, 1 deletion
db/db.ddl
db/upgrade-20210928.sql
+8
-0
8 additions, 0 deletions
db/upgrade-20210928.sql
mo/db.py
+15
-0
15 additions, 0 deletions
mo/db.py
with
31 additions
and
1 deletion
db/db.ddl
+
8
−
1
View file @
c4f1f608
...
@@ -179,13 +179,20 @@ CREATE TABLE participations (
...
@@ -179,13 +179,20 @@ CREATE TABLE participations (
CREATE INDEX participations_contest_id_index ON participations (contest_id, place_id);
CREATE INDEX participations_contest_id_index ON participations (contest_id, place_id);
-- Úloha
-- Úlohy
CREATE TYPE task_type AS ENUM (
'regular', -- obyčejná úloha
'cms' -- praktická úloha kategorie P odevzdávaná přes CMS
);
CREATE TABLE tasks (
CREATE TABLE tasks (
task_id serial PRIMARY KEY,
task_id serial PRIMARY KEY,
round_id int NOT NULL REFERENCES rounds(round_id),
round_id int NOT NULL REFERENCES rounds(round_id),
code varchar(255) NOT NULL, -- např. "P-I-1"
code varchar(255) NOT NULL, -- např. "P-I-1"
name varchar(255) NOT NULL,
name varchar(255) NOT NULL,
max_points numeric(5,1) DEFAULT NULL, -- maximální počet bodů, pokud je nastaven, nelze zadat více bodů
max_points numeric(5,1) DEFAULT NULL, -- maximální počet bodů, pokud je nastaven, nelze zadat více bodů
type task_type NOT NULL DEFAULT 'regular',
UNIQUE (round_id, code)
UNIQUE (round_id, code)
);
);
...
...
This diff is collapsed.
Click to expand it.
db/upgrade-20210928.sql
0 → 100644
+
8
−
0
View file @
c4f1f608
SET
ROLE
'mo_osmo'
;
CREATE
TYPE
task_type
AS
ENUM
(
'regular'
,
-- obyčejná úloha
'cms'
-- praktická úloha kategorie P odevzdávaná přes CMS
);
ALTER
TABLE
tasks
ADD
COLUMN
type
task_type
NOT
NULL
DEFAULT
'regular'
;
This diff is collapsed.
Click to expand it.
mo/db.py
+
15
−
0
View file @
c4f1f608
...
@@ -476,6 +476,20 @@ class Participation(Base):
...
@@ -476,6 +476,20 @@ class Participation(Base):
user
=
relationship
(
'
User
'
)
user
=
relationship
(
'
User
'
)
class
TaskType
(
MOEnum
):
regular
=
auto
()
cms
=
auto
()
def
friendly_name
(
self
)
->
str
:
return
task_type_names
[
self
]
task_type_names
=
{
TaskType
.
regular
:
'
standardní
'
,
TaskType
.
cms
:
'
programovací (CMS)
'
,
}
class
Task
(
Base
):
class
Task
(
Base
):
__tablename__
=
'
tasks
'
__tablename__
=
'
tasks
'
__table_args__
=
(
__table_args__
=
(
...
@@ -487,6 +501,7 @@ class Task(Base):
...
@@ -487,6 +501,7 @@ class Task(Base):
code
=
Column
(
String
(
255
),
nullable
=
False
)
code
=
Column
(
String
(
255
),
nullable
=
False
)
name
=
Column
(
String
(
255
),
nullable
=
False
)
name
=
Column
(
String
(
255
),
nullable
=
False
)
max_points
=
Column
(
Numeric
)
max_points
=
Column
(
Numeric
)
type
=
Column
(
Enum
(
TaskType
,
name
=
'
task_type
'
),
nullable
=
False
,
default
=
TaskType
.
regular
)
round
=
relationship
(
'
Round
'
)
round
=
relationship
(
'
Round
'
)
...
...
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