aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-07-11 22:36:49 +0100
committerGravatar Joe Banks <[email protected]>2024-07-11 22:44:19 +0100
commit3b6464f25a8b299bbffddb0bbb608263fc207c72 (patch)
treebeffcfb2d2ee030d11439a29057ac3cd41a73a7c /backend
parentAdd new endpoint for performing condorcet calculation on form responses (diff)
Ensure requested condorcet calculations are on vote components
Diffstat (limited to 'backend')
-rw-r--r--backend/routes/forms/condorcet.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/backend/routes/forms/condorcet.py b/backend/routes/forms/condorcet.py
index 1b216a1..902770b 100644
--- a/backend/routes/forms/condorcet.py
+++ b/backend/routes/forms/condorcet.py
@@ -78,6 +78,11 @@ class Condorcet(Route):
detail="Requested more winners than there are candidates", status_code=400
)
+ if question.type != "vote":
+ raise InvalidCondorcetRequest(
+ detail="Requested question is not a condorcet vote component", status_code=400
+ )
+
cursor = request.state.db.responses.find(
{"form_id": form_id},
)