Skip to content
Snippets Groups Projects
Commit 9a221821 authored by Albin Henriksson's avatar Albin Henriksson
Browse files

Merge branch 'dev' of...

Merge branch 'dev' of https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system into 43-test-competition-view
parents 3968d98d 8581599f
No related branches found
No related tags found
1 merge request!44Resolve "test competition view"
Pipeline #38862 passed
...@@ -12,9 +12,6 @@ class Blacklist(db.Model): ...@@ -12,9 +12,6 @@ class Blacklist(db.Model):
def __init__(self, jti): def __init__(self, jti):
self.jti = jti self.jti = jti
def get_dict(self):
return {"id": self.id, "jti": self.jti, "expire_date": self.expire_date}
class Role(db.Model): class Role(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
...@@ -25,9 +22,6 @@ class Role(db.Model): ...@@ -25,9 +22,6 @@ class Role(db.Model):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
def get_dict(self):
return {"id": self.id, "name": self.name}
# TODO Region? # TODO Region?
class City(db.Model): class City(db.Model):
...@@ -64,15 +58,6 @@ class User(db.Model): ...@@ -64,15 +58,6 @@ class User(db.Model):
self.city_id = city_id self.city_id = city_id
self.authenticated = False self.authenticated = False
def get_dict(self):
return {
"id": self.id,
"email": self.email,
"name": self.name,
"role_id": self.role_id,
"city_id": self.city_id,
}
@hybrid_property @hybrid_property
def password(self): def password(self):
return self._password return self._password
...@@ -152,7 +137,7 @@ class Slide(db.Model): ...@@ -152,7 +137,7 @@ class Slide(db.Model):
title = db.Column(db.String(STRING_SIZE), nullable=False, default="") title = db.Column(db.String(STRING_SIZE), nullable=False, default="")
body = db.Column(db.Text, nullable=False, default="") body = db.Column(db.Text, nullable=False, default="")
timer = db.Column(db.Integer, nullable=False, default=0) timer = db.Column(db.Integer, nullable=False, default=0)
tweak_settings = db.Column(db.Text, nullable=False, default="") settings = db.Column(db.Text, nullable=False, default="{}") # Json object
competition_id = db.Column(db.Integer, db.ForeignKey("competition.id"), nullable=False) competition_id = db.Column(db.Integer, db.ForeignKey("competition.id"), nullable=False)
questions = db.relationship("Question", backref="slide") questions = db.relationship("Question", backref="slide")
...@@ -194,7 +179,6 @@ class QuestionAlternative(db.Model): ...@@ -194,7 +179,6 @@ class QuestionAlternative(db.Model):
self.question_id = question_id self.question_id = question_id
# TODO QuestionAnswer
class QuestionAnswer(db.Model): class QuestionAnswer(db.Model):
__table_args__ = (db.UniqueConstraint("question_id", "team_id"),) __table_args__ = (db.UniqueConstraint("question_id", "team_id"),)
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
...@@ -226,4 +210,3 @@ class QuestionType(db.Model): ...@@ -226,4 +210,3 @@ class QuestionType(db.Model):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
...@@ -2,14 +2,13 @@ import app.core.controller as dbc ...@@ -2,14 +2,13 @@ import app.core.controller as dbc
from app import create_app, db from app import create_app, db
from app.core.models import City, MediaType, QuestionType, Role, Style, User from app.core.models import City, MediaType, QuestionType, Role, Style, User
user = {"email": "test@test.se", "password": "password", "role": "Admin", "city": "Linköping"}
media_types = ["Image", "Video"]
question_types = ["Boolean", "Multiple", "Text"]
roles = ["Admin", "Editor"]
cities = ["Linköping"]
def _add_items(): def _add_items():
media_types = ["Image", "Video"]
question_types = ["Boolean", "Multiple", "Text"]
roles = ["Admin", "Editor"]
cities = ["Linköping"]
# Add media types # Add media types
for item in media_types: for item in media_types:
db.session.add(MediaType(item)) db.session.add(MediaType(item))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment