Half-Working order-answers

This commit is contained in:
Mawoka
2023-01-02 18:18:44 +01:00
parent 629822b2df
commit 0f000987ca
13 changed files with 664 additions and 314 deletions
+3
View File
@@ -116,6 +116,7 @@ class QuizQuestionType(str, Enum):
VOTING = "VOTING"
SLIDE = "SLIDE"
TEXT = "TEXT"
ORDER = "ORDER"
class TextQuizAnswer(BaseModel):
@@ -140,6 +141,8 @@ class QuizQuestion(BaseModel):
raise ValueError("Answer must be from type VotingQuizAnswer if type is VOTING")
if values["type"] == QuizQuestionType.TEXT and type(v[0]) != TextQuizAnswer:
raise ValueError("Answer must be from type TextQuizAnswer if type is TEXT")
if values["type"] == QuizQuestionType.ORDER and type(v[0]) != VotingQuizAnswer:
raise ValueError("Answer must be from type VotingQuizAnswer if type is ORDER")
if values["type"] == QuizQuestionType.SLIDE and type(v[0]) != str:
raise ValueError("Answer must be from type SlideElement if type is SLIDE")
return v