Open
Conversation
…n into fkm/form-submission
| "QuestionNotFound": status.HTTP_404_NOT_FOUND, | ||
| "QuestionOptionNotFound": status.HTTP_404_NOT_FOUND | ||
| } | ||
| error_helper = lambda msg: Response(msg, CODE_MAPPINGS[msg]) |
Contributor
There was a problem hiding this comment.
Skriv om som funktion?
| session_id = serializers.CharField(required=True) | ||
| form_data = serializers.ListField(child=QuestionSerializer(), required=True) | ||
|
|
||
| def validate_payment( |
|
|
||
| return payment | ||
|
|
||
| def validate_event( |
Contributor
There was a problem hiding this comment.
Kanske tydligare namn?
| if not chapter_event.question_set.filter(pk=qs["question_id"]).exists(): | ||
| return error_helper("QuestionNotFound") | ||
|
|
||
| q_db = chapter_event.question_set.get(pk=qs["question_id"]) |
Contributor
There was a problem hiding this comment.
Kommer skicka en jäkla massa DB requests men spelar förmodligen ingen roll
| if isinstance(payment, Response): | ||
| return payment | ||
|
|
||
| # Only supports forms if there are one ticket (for now). |
Contributor
There was a problem hiding this comment.
Kracha om fler än en ticket?
| r["question_id"]: r for r in response_data["form_data"] | ||
| } | ||
|
|
||
| q_errors = validate_questions(form_data_map, chapter_event) |
| if q_errors: | ||
| return q_errors | ||
|
|
||
| # Update everhything at once (!?) if the session is valid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add endpoint for form submission to the database.