Compare commits
No commits in common. "71853ac32d0923e6215799459a267fdda52e73a1" and "36dadd7ac132aeb24d5418a86bd64ec6bd5d39ab" have entirely different histories.
71853ac32d
...
36dadd7ac1
@ -1,9 +0,0 @@
|
|||||||
from typing import Literal
|
|
||||||
|
|
||||||
from .answer_base import AnswerBase
|
|
||||||
from fiber_package.signup.enums import FormElementCategory
|
|
||||||
|
|
||||||
class AnswerCheckmarks(AnswerBase):
|
|
||||||
category: Literal[FormElementCategory.checkmarks]
|
|
||||||
|
|
||||||
answer_list: list[bool]
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
from typing import Literal
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from .form_base_question import FormBaseQuestion
|
|
||||||
from fiber_package.signup.enums import FormElementCategory
|
|
||||||
|
|
||||||
from fiber_package.signup.answer.answer_checkmarks import AnswerCheckmarks
|
|
||||||
|
|
||||||
class CheckmarkQuestion(BaseModel):
|
|
||||||
question_en: str
|
|
||||||
question_nl: str
|
|
||||||
|
|
||||||
class FormCheckmarks(FormBaseQuestion):
|
|
||||||
category: Literal[FormElementCategory.checkmarks]
|
|
||||||
|
|
||||||
questions: list[CheckmarkQuestion]
|
|
||||||
|
|
||||||
def validate_answer(self, answer: AnswerCheckmarks) -> None:
|
|
||||||
if answer.question_name != self.name:
|
|
||||||
raise ValueError("Answer question name does not match.")
|
|
||||||
|
|
||||||
answer_list = answer.answer_list
|
|
||||||
if len(answer_list) != len(self.questions):
|
|
||||||
raise ValueError("Length of answer question list does not match.")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -3,7 +3,6 @@ from typing import Annotated
|
|||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
|
||||||
from .form_open_questions import FormOpenQuestions
|
from .form_open_questions import FormOpenQuestions
|
||||||
from .form_checkmarks import FormCheckmarks
|
|
||||||
from .form_text import FormText
|
from .form_text import FormText
|
||||||
from .form_title import FormTitle
|
from .form_title import FormTitle
|
||||||
|
|
||||||
@ -13,7 +12,7 @@ FormTextUnion = Annotated[
|
|||||||
]
|
]
|
||||||
|
|
||||||
FormQuestionUnion = Annotated[
|
FormQuestionUnion = Annotated[
|
||||||
FormOpenQuestions | FormCheckmarks,
|
FormOpenQuestions,
|
||||||
Field(discriminator="category")
|
Field(discriminator="category")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,9 @@ class FormElementCategory(StrEnum):
|
|||||||
text_piece = "text_piece"
|
text_piece = "text_piece"
|
||||||
title_text = "title_text"
|
title_text = "title_text"
|
||||||
open_questions = "open_questions"
|
open_questions = "open_questions"
|
||||||
checkmarks = "checkmarks"
|
|
||||||
|
|
||||||
FormQuestionCategory = Literal[
|
FormQuestionCategory = Literal[
|
||||||
FormElementCategory.open_questions,
|
FormElementCategory.open_questions
|
||||||
FormElementCategory.checkmarks
|
|
||||||
]
|
]
|
||||||
|
|
||||||
FormTextCategory = Literal[
|
FormTextCategory = Literal[
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
In order to add a new question type you need to:
|
|
||||||
|
|
||||||
1) Make a new tag in enums.py
|
|
||||||
2) add it to the list of question tags
|
|
||||||
3) Create the FormXXX in element
|
|
||||||
4) Create the AnswerXXX in answer
|
|
||||||
5) Add it to the question union type in answer.types
|
|
||||||
Tip: run ./pre-commit to run the typechecker to see if you got your imports right!
|
|
||||||
6) Add it to fiber-django
|
|
||||||
@ -34,6 +34,11 @@ List of question types:
|
|||||||
* feedback --> feedabck (str)
|
* feedback --> feedabck (str)
|
||||||
* team --> teamname (str)
|
* team --> teamname (str)
|
||||||
|
|
||||||
|
Maybe a bug?
|
||||||
|
If nnvbijdrage is set but nnv is not part of activity,
|
||||||
|
then everybody pays the LOW price as if NNV pays ??!!
|
||||||
|
Not a bug! You cannot set NNV if NNV is not part of sjabloon!
|
||||||
|
... its handled by custom js....
|
||||||
|
|
||||||
|
|
||||||
omg it is TERRIBLE. In Silk every sjabloon has its OWN template ?!
|
omg it is TERRIBLE. In Silk every sjabloon has its OWN template ?!
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user