Made editor great

This commit is contained in:
Mawoka
2022-12-24 13:52:15 +01:00
parent 7a79630eb4
commit 809a9024b6
8 changed files with 1357 additions and 141 deletions
+2 -12
View File
@@ -123,21 +123,11 @@ class SlideElementTypes(str, Enum):
CIRCLE = "CIRCLE"
class SlideElement(BaseModel):
type: SlideElementTypes
x: float
y: float
height: float
width: float
data: str
id: int
class QuizQuestion(BaseModel):
question: str
time: str # in Secs
type: None | QuizQuestionType = QuizQuestionType.ABCD
answers: list[ABCDQuizAnswer] | RangeQuizAnswer | list[VotingQuizAnswer] | list[SlideElement]
answers: list[ABCDQuizAnswer] | RangeQuizAnswer | list[VotingQuizAnswer] | str
image: str | None = None
@validator("answers")
@@ -148,7 +138,7 @@ class QuizQuestion(BaseModel):
raise ValueError("Answer must be from type RangeQuizAnswer if type is RANGE")
if values["type"] == QuizQuestionType.VOTING and type(v[0]) != VotingQuizAnswer:
raise ValueError("Answer must be from type VotingQuizAnswer if type is VOTING")
if values["type"] == QuizQuestionType.SLIDE and type(v[0]) != SlideElement:
if values["type"] == QuizQuestionType.SLIDE and type(v[0]) != str:
raise ValueError("Answer must be from type SlideElement if type is SLIDE")
return v