Skip to content
Snippets Groups Projects
Commit 89a7cdf4 authored by Victor Löfgren's avatar Victor Löfgren
Browse files

Merge branch 'dev' of gitlab.liu.se:tddd96-grupp11/teknikattan-scoring-system...

Merge branch 'dev' of gitlab.liu.se:tddd96-grupp11/teknikattan-scoring-system into 170-add-server-comments
parents ef10c47c 93baed60
No related branches found
No related tags found
1 merge request!135Resolve "Add server comments"
Pipeline #45925 passed
This commit is part of merge request !135. Comments created here will be created in the context of that merge request.
import { Divider, ListItem, ListItemText, Typography } from '@material-ui/core'
import { Divider, ListItem, ListItemText } from '@material-ui/core'
import axios from 'axios'
import React from 'react'
import { getEditorCompetition } from '../../../../actions/editor'
import { useAppDispatch, useAppSelector } from '../../../../hooks'
import { TextComponent } from '../../../../interfaces/ApiModels'
import { RichSlide } from '../../../../interfaces/ApiRichModels'
import { AddButton, Center, SettingsList, TextCard } from '../styled'
import TextComponentEdit from '../TextComponentEdit'
import axios from 'axios'
import { getEditorCompetition } from '../../../../actions/editor'
type TextsProps = {
activeViewTypeId: number
......@@ -27,7 +27,7 @@ const Texts = ({ activeViewTypeId, activeSlide, competitionId }: TextsProps) =>
if (activeSlide) {
await axios.post(`/api/competitions/${competitionId}/slides/${activeSlide?.id}/components`, {
type_id: 1,
text: 'Ny text',
text: '<p><span style="font-size: 24pt;">Ny text</span></p>',
w: 315,
h: 50,
view_type_id: activeViewTypeId,
......
......@@ -14,6 +14,7 @@ class RichSchema(ma.SQLAlchemySchema):
strict = True
load_instance = True
include_relationships = True
ordered = False
class QuestionSchemaRich(RichSchema):
......
......@@ -13,6 +13,7 @@ class BaseSchema(ma.SQLAlchemySchema):
strict = True
load_instance = False
include_relationships = False
ordered = False
class IdNameSchema(BaseSchema):
......
......@@ -19,7 +19,7 @@ from app.database.models import (
User,
)
from sqlalchemy import func
from sqlalchemy.orm import joinedload
from sqlalchemy.orm import joinedload, subqueryload
from sqlalchemy.orm.util import with_polymorphic
......@@ -305,15 +305,15 @@ def component_list(competition_id, slide_id):
def competition(competition_id):
""" Get Competition and all it's sub-entities. """
os1 = joinedload(Competition.slides).joinedload(Slide.components)
os2 = joinedload(Competition.slides).joinedload(Slide.questions).joinedload(Question.alternatives)
ot = joinedload(Competition.teams).joinedload(Team.question_alternative_answers)
ot1 = joinedload(Competition.teams).joinedload(Team.question_scores)
join_component = joinedload(Competition.slides).subqueryload(Slide.components)
join_alternatives = joinedload(Competition.slides).joinedload(Slide.questions).joinedload(Question.alternatives)
join_question_alternative_answer = joinedload(Competition.teams).joinedload(Team.question_alternative_answers)
join_question_score = joinedload(Competition.teams).joinedload(Team.question_scores)
return (
Competition.query.filter(Competition.id == competition_id)
.options(os1)
.options(os2)
.options(ot)
.options(ot1)
.options(join_component)
.options(join_alternatives)
.options(join_question_alternative_answer)
.options(join_question_score)
.first()
)
......@@ -19,6 +19,7 @@ class Config:
SQLALCHEMY_ECHO = False
USER_LOGIN_LOCKED_ATTEMPTS = 12
USER_LOGIN_LOCKED_EXPIRES = timedelta(hours=3)
JSON_SORT_KEYS = False
class DevelopmentConfig(Config):
......
......@@ -86,13 +86,17 @@ def create_default_items():
y = random.randrange(1, 500)
w = random.randrange(150, 400)
h = random.randrange(150, 400)
dbc.add.component(1, item_slide.id, 1, x, y, w, h, text=f"hej{k}")
dbc.add.component(
1, item_slide.id, 1, x, y, w, h, text=f"<p><span style='font-size: 24pt;'>{k}</span></p>"
)
for k in range(3):
x = random.randrange(1, 500)
y = random.randrange(1, 500)
w = random.randrange(150, 400)
h = random.randrange(150, 400)
dbc.add.component(1, item_slide.id, 3, x, y, w, h, text=f"hej{k}")
dbc.add.component(
1, item_slide.id, 3, x, y, w, h, text=f"<p><span style='font-size: 24pt;'>{k}</span></p>"
)
# item_slide = dbc.add.slide(item_comp)
# item_slide.title = f"Slide {len(item_comp.slides)}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment