Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Commits
8581599f
Commit
8581599f
authored
3 years ago
by
robban64
Browse files
Options
Downloads
Patches
Plain Diff
fix: small fixes
parent
356a1e32
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38840
passed
3 years ago
Stage: setup
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/app/core/models.py
+1
-18
1 addition, 18 deletions
server/app/core/models.py
server/populate.py
+5
-6
5 additions, 6 deletions
server/populate.py
with
6 additions
and
24 deletions
server/app/core/models.py
+
1
−
18
View file @
8581599f
...
...
@@ -12,9 +12,6 @@ class Blacklist(db.Model):
def
__init__
(
self
,
jti
):
self
.
jti
=
jti
def
get_dict
(
self
):
return
{
"
id
"
:
self
.
id
,
"
jti
"
:
self
.
jti
,
"
expire_date
"
:
self
.
expire_date
}
class
Role
(
db
.
Model
):
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
...
...
@@ -25,9 +22,6 @@ class Role(db.Model):
def
__init__
(
self
,
name
):
self
.
name
=
name
def
get_dict
(
self
):
return
{
"
id
"
:
self
.
id
,
"
name
"
:
self
.
name
}
# TODO Region?
class
City
(
db
.
Model
):
...
...
@@ -64,15 +58,6 @@ class User(db.Model):
self
.
city_id
=
city_id
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
def
password
(
self
):
return
self
.
_password
...
...
@@ -152,7 +137,7 @@ class Slide(db.Model):
title
=
db
.
Column
(
db
.
String
(
STRING_SIZE
),
nullable
=
False
,
default
=
""
)
body
=
db
.
Column
(
db
.
Text
,
nullable
=
False
,
default
=
""
)
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
)
questions
=
db
.
relationship
(
"
Question
"
,
backref
=
"
slide
"
)
...
...
@@ -194,7 +179,6 @@ class QuestionAlternative(db.Model):
self
.
question_id
=
question_id
# TODO QuestionAnswer
class
QuestionAnswer
(
db
.
Model
):
__table_args__
=
(
db
.
UniqueConstraint
(
"
question_id
"
,
"
team_id
"
),)
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
)
...
...
@@ -226,4 +210,3 @@ class QuestionType(db.Model):
def
__init__
(
self
,
name
):
self
.
name
=
name
This diff is collapsed.
Click to expand it.
server/populate.py
+
5
−
6
View file @
8581599f
...
...
@@ -2,14 +2,13 @@ import app.core.controller as dbc
from
app
import
create_app
,
db
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
():
media_types
=
[
"
Image
"
,
"
Video
"
]
question_types
=
[
"
Boolean
"
,
"
Multiple
"
,
"
Text
"
]
roles
=
[
"
Admin
"
,
"
Editor
"
]
cities
=
[
"
Linköping
"
]
# Add media types
for
item
in
media_types
:
db
.
session
.
add
(
MediaType
(
item
))
...
...
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