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
082cef8d
Commit
082cef8d
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
DB: Změna ukládání poničených PDF
Viz issue
#150
.
parent
08d7c480
No related branches found
No related tags found
1 merge request
!53
Změna reprezentace rozbitých submitů
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/db.ddl
+7
-3
7 additions, 3 deletions
db/db.ddl
db/upgrade-20210315.sql
+13
-0
13 additions, 0 deletions
db/upgrade-20210315.sql
mo/db.py
+8
-2
8 additions, 2 deletions
mo/db.py
with
28 additions
and
5 deletions
db/db.ddl
+
7
−
3
View file @
082cef8d
...
...
@@ -181,9 +181,13 @@ CREATE TABLE papers (
uploaded_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
pages int DEFAULT NULL, -- počet stránek
bytes int DEFAULT NULL, -- velikost souboru
file_name varchar(255) NOT NULL, -- relativní cesta k souboru
note text NOT NULL DEFAULT '', -- komentář uploadujícího
broken bool NOT NULL DEFAULT false -- poničené PDF přijaté s varováním
file_name varchar(255) DEFAULT NULL, -- relativní cesta k souboru
orig_file_name varchar(255) DEFAULT NULL, -- původní cesta, pokud PDF bylo poničené
note text NOT NULL DEFAULT '' -- komentář uploadujícího
-- Sémantika práce s poničenými soubory:
-- - správná PDF mají orig_file_name=NULL
-- - pokud někdo odevzdá poničené, vyplní se orig_file_name, ale file_name=NULL
-- - časem se spustí oprava, která vyplní i file_name a přepočítá bytes
);
CREATE INDEX papers_for_task_index ON papers (for_task);
...
...
This diff is collapsed.
Click to expand it.
db/upgrade-20210315.sql
0 → 100644
+
13
−
0
View file @
082cef8d
SET
ROLE
'mo_osmo'
;
ALTER
TABLE
papers
ADD
COLUMN
orig_file_name
varchar
(
255
)
DEFAULT
NULL
;
ALTER
TABLE
papers
ALTER
COLUMN
file_name
DROP
NOT
NULL
;
ALTER
TABLE
papers
ALTER
COLUMN
file_name
SET
DEFAULT
NULL
;
ALTER
TABLE
papers
DROP
COLUMN
broken
;
This diff is collapsed.
Click to expand it.
mo/db.py
+
8
−
2
View file @
082cef8d
...
...
@@ -489,9 +489,9 @@ class Paper(Base):
uploaded_at
=
Column
(
DateTime
(
True
),
nullable
=
False
,
server_default
=
text
(
"
CURRENT_TIMESTAMP
"
))
pages
=
Column
(
Integer
)
bytes
=
Column
(
Integer
)
file_name
=
Column
(
String
(
255
),
nullable
=
False
)
file_name
=
Column
(
String
(
255
))
orig_file_name
=
Column
(
String
(
255
))
note
=
Column
(
Text
,
nullable
=
False
,
server_default
=
text
(
"''
::text
"
))
broken
=
Column
(
Boolean
,
nullable
=
False
,
server_default
=
text
(
"
false
"
))
task
=
relationship
(
'
Task
'
)
for_user_obj
=
relationship
(
'
User
'
,
primaryjoin
=
'
Paper.for_user == User.user_id
'
)
...
...
@@ -510,6 +510,12 @@ class Paper(Base):
else
:
return
None
def
is_broken
(
self
)
->
bool
:
return
self
.
file_name
is
None
def
is_fixed
(
self
)
->
bool
:
return
self
.
orig_file_name
is
not
None
and
self
.
file_name
is
not
None
class
PointsHistory
(
Base
):
__tablename__
=
'
points_history
'
...
...
This diff is collapsed.
Click to expand it.
Martin Mareš
@mj
mentioned in issue
#150 (closed)
·
4 years ago
mentioned in issue
#150 (closed)
mentioned in issue #150
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