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
57d28028
Commit
57d28028
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Tabulka s výsledky zpracování scanů
parent
abc0f91b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/db.ddl
+17
-0
17 additions, 0 deletions
db/db.ddl
db/upgrade-20210701.sql
+10
-0
10 additions, 0 deletions
db/upgrade-20210701.sql
mo/db.py
+23
-0
23 additions, 0 deletions
mo/db.py
with
50 additions
and
0 deletions
db/db.ddl
+
17
−
0
View file @
57d28028
...
...
@@ -397,3 +397,20 @@ CREATE VIEW region_task_stats AS
JOIN solutions s USING(user_id, task_id)
JOIN region_descendants rd ON rd.descendant = c.place_id
GROUP BY r.round_id, rd.region, t.task_id;
-- Stav zpracování scanů (vázaný na joby)
CREATE TABLE scan_pages (
job_id int NOT NULL REFERENCES jobs(job_id) ON DELETE CASCADE,
file_nr int NOT NULL, -- co to je za stránku (od 0)
page_nr int NOT NULL,
user_id int DEFAULT NULL REFERENCES users(user_id), -- přiřazení účastníkovi a úloze
task_id int DEFAULT NULL REFERENCES tasks(task_id),
seq_id int NOT NULL, -- pořadové číslo v rámci úlohy (od 0)
-- Pokud user_id i task_id jsou NULL, seq_id znamená:
-- -1 pro stránku vyžadující pozornost
-- -2 pro prázdnou stránku
-- -3 pro pokračovací stránku
-- -4 pro stránku, která nepatří do této soutěže
UNIQUE (job_id, file_nr, page_nr)
);
This diff is collapsed.
Click to expand it.
db/upgrade-20210701.sql
+
10
−
0
View file @
57d28028
...
...
@@ -4,3 +4,13 @@ ALTER TYPE job_type ADD VALUE 'create_protocols';
ALTER
TYPE
job_type
ADD
VALUE
'process_scans'
;
ALTER
TYPE
job_state
ADD
VALUE
'preparing'
;
CREATE
TABLE
scan_pages
(
job_id
int
NOT
NULL
REFERENCES
jobs
(
job_id
)
ON
DELETE
CASCADE
,
file_nr
int
NOT
NULL
,
-- co to je za stránku
page_nr
int
NOT
NULL
,
user_id
int
DEFAULT
NULL
REFERENCES
users
(
user_id
),
-- přiřazení účastníkovi a úloze
task_id
int
DEFAULT
NULL
REFERENCES
tasks
(
task_id
),
seq_id
int
NOT
NULL
,
-- pořadové číslo v rámci úlohy
UNIQUE
(
job_id
,
file_nr
,
page_nr
)
);
This diff is collapsed.
Click to expand it.
mo/db.py
+
23
−
0
View file @
57d28028
...
...
@@ -764,6 +764,29 @@ class RegionTaskStat(Base):
task
=
relationship
(
'
Task
'
)
class
ScanPage
(
Base
):
__tablename__
=
'
scan_pages
'
job_id
=
Column
(
Integer
,
ForeignKey
(
'
jobs.job_id
'
,
ondelete
=
'
CASCADE
'
),
primary_key
=
True
,
nullable
=
False
)
file_nr
=
Column
(
Integer
,
primary_key
=
True
,
nullable
=
False
)
page_nr
=
Column
(
Integer
,
primary_key
=
True
,
nullable
=
False
)
user_id
=
Column
(
Integer
,
ForeignKey
(
'
users.user_id
'
))
task_id
=
Column
(
Integer
,
ForeignKey
(
'
tasks.task_id
'
))
seq_id
=
Column
(
Integer
,
nullable
=
False
)
UniqueConstraint
(
'
job_id
'
,
'
file_nr
'
,
'
page_nr
'
)
job
=
relationship
(
'
Job
'
)
user
=
relationship
(
'
User
'
)
task
=
relationship
(
'
Task
'
)
# Speciální seq_id ve ScanPage
SCAN_PAGE_FIX
=
-
1
SCAN_PAGE_EMPTY
=
-
2
SCAN_PAGE_CONTINUE
=
-
3
SCAN_PAGE_UFO
=
-
4
_engine
:
Optional
[
Engine
]
=
None
_session
:
Optional
[
Session
]
=
None
flask_db
:
Any
=
None
...
...
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