Skip to content
Snippets Groups Projects
Commit 6bf46722 authored by Martin Mareš's avatar Martin Mareš
Browse files

DB: Řešení má flag "is_empty" indikující prázdný protokol

Prázdné protokoly jsou vždy hodnoceny 0 body, ale někdy je chceme
zobrazovat odlišně.

See #277.
parent 9d561595
No related branches found
No related tags found
1 merge request!134Prázdné protokoly
...@@ -265,6 +265,7 @@ CREATE TABLE solutions ( ...@@ -265,6 +265,7 @@ CREATE TABLE solutions (
points numeric(5,1) DEFAULT NULL, points numeric(5,1) DEFAULT NULL,
note text NOT NULL DEFAULT '', -- komentář pro řešitele note text NOT NULL DEFAULT '', -- komentář pro řešitele
org_note text NOT NULL DEFAULT '', -- komentář viditelný jen organizátorům org_note text NOT NULL DEFAULT '', -- komentář viditelný jen organizátorům
is_empty bool NOT NULL DEFAULT false, -- prázdný papír (v tomto případě je vždy points=0)
PRIMARY KEY (task_id, user_id) PRIMARY KEY (task_id, user_id)
); );
...@@ -277,7 +278,8 @@ CREATE TABLE points_history ( ...@@ -277,7 +278,8 @@ CREATE TABLE points_history (
participant_id int NOT NULL REFERENCES users(user_id), participant_id int NOT NULL REFERENCES users(user_id),
points numeric(5,1) DEFAULT NULL, points numeric(5,1) DEFAULT NULL,
points_by int NOT NULL REFERENCES users(user_id), -- kdo přidělil body points_by int NOT NULL REFERENCES users(user_id), -- kdo přidělil body
points_at timestamp with time zone NOT NULL -- a kdy points_at timestamp with time zone NOT NULL, -- a kdy
is_empty bool NOT NULL DEFAULT false
); );
CREATE INDEX points_history_index ON points_history (task_id, participant_id); CREATE INDEX points_history_index ON points_history (task_id, participant_id);
... ...
......
SET ROLE 'mo_osmo';
ALTER TABLE solutions
ADD COLUMN is_empty bool NOT NULL DEFAULT false;
ALTER TABLE points_history
ADD COLUMN is_empty bool NOT NULL DEFAULT false;
...@@ -748,6 +748,7 @@ class PointsHistory(Base): ...@@ -748,6 +748,7 @@ class PointsHistory(Base):
points = Column(Numeric) points = Column(Numeric)
points_by = Column(Integer, ForeignKey('users.user_id'), nullable=False) points_by = Column(Integer, ForeignKey('users.user_id'), nullable=False)
points_at = Column(DateTime(True), nullable=False) points_at = Column(DateTime(True), nullable=False)
is_empty = Column(Boolean, server_default=text("false"), nullable=False)
participant = relationship('User', primaryjoin='PointsHistory.participant_id == User.user_id') participant = relationship('User', primaryjoin='PointsHistory.participant_id == User.user_id')
user = relationship('User', primaryjoin='PointsHistory.points_by == User.user_id') user = relationship('User', primaryjoin='PointsHistory.points_by == User.user_id')
...@@ -764,6 +765,7 @@ class Solution(Base): ...@@ -764,6 +765,7 @@ class Solution(Base):
points = Column(Numeric) points = Column(Numeric)
note = Column(Text, nullable=False, server_default=text("''::text")) note = Column(Text, nullable=False, server_default=text("''::text"))
org_note = Column(Text, nullable=False, server_default=text("''::text")) org_note = Column(Text, nullable=False, server_default=text("''::text"))
is_empty = Column(Boolean, server_default=text("false"), nullable=False)
final_submit_obj = relationship('Paper', primaryjoin='Solution.final_submit == Paper.paper_id') final_submit_obj = relationship('Paper', primaryjoin='Solution.final_submit == Paper.paper_id')
final_feedback_obj = relationship('Paper', primaryjoin='Solution.final_feedback == Paper.paper_id') final_feedback_obj = relationship('Paper', primaryjoin='Solution.final_feedback == Paper.paper_id')
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment