From 3b6464f25a8b299bbffddb0bbb608263fc207c72 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Thu, 11 Jul 2024 22:36:49 +0100 Subject: Ensure requested condorcet calculations are on vote components --- backend/routes/forms/condorcet.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'backend') 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}, ) -- cgit v1.2.3