aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/forms/submit.py
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-02-24 13:53:08 +0100
committerGravatar Matteo Bertucci <[email protected]>2021-02-24 13:53:08 +0100
commitda6b581185e8bbe37e561a05827c8517824c7d2c (patch)
tree2b4f0591fc9b76b74eaa1afd17161758331777c1 /backend/routes/forms/submit.py
parentHook up unittesting in the submit protocol (diff)
Switch to 100 chars line length and get rid of the noqas
Diffstat (limited to 'backend/routes/forms/submit.py')
-rw-r--r--backend/routes/forms/submit.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/backend/routes/forms/submit.py b/backend/routes/forms/submit.py
index 85a4226..c19fc2d 100644
--- a/backend/routes/forms/submit.py
+++ b/backend/routes/forms/submit.py
@@ -100,7 +100,10 @@ class SubmitForm(Route):
if request.user.is_authenticated:
response["user"] = request.user.payload
- if FormFeatures.COLLECT_EMAIL.value in form.features and "email" not in response["user"]: # noqa
+ if (
+ FormFeatures.COLLECT_EMAIL.value in form.features
+ and "email" not in response["user"]
+ ):
return JSONResponse({
"error": "email_required"
}, status_code=400)
@@ -134,11 +137,15 @@ class SubmitForm(Route):
was_successful = all(test.passed for test in unittest_results)
if not was_successful:
- status_code = 500 if any(test.return_code == 99 for test in unittest_results) else 200
+ status_code = 500 if any(
+ test.return_code == 99 for test in unittest_results
+ ) else 200
return JSONResponse({
"error": "failed_tests",
- "test_results": [test._asdict() for test in unittest_results if not test.passed]
+ "test_results": [
+ test._asdict() for test in unittest_results if not test.passed
+ ]
}, status_code=status_code)
await request.state.db.responses.insert_one(
@@ -186,7 +193,7 @@ class SubmitForm(Route):
embed = {
"title": "New Form Response",
"description": f"{mention} submitted a response to `{form.name}`.",
- "url": f"{FRONTEND_URL}/path_to_view_form/{response.id}", # noqa # TODO: Enter Form View URL
+ "url": f"{FRONTEND_URL}/path_to_view_form/{response.id}", # TODO: Enter Form View URL
"timestamp": response.timestamp,
"color": 7506394,
}