Skip to content

fix(results): guard participationclass against zero participants (#2709)#2727

Closed
SAY-5 wants to merge 1 commit into
e-valuation:mainfrom
SAY-5:say5-fix-participationclass-zero
Closed

fix(results): guard participationclass against zero participants (#2709)#2727
SAY-5 wants to merge 1 commit into
e-valuation:mainfrom
SAY-5:say5-fix-participationclass-zero

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 11, 2026

Copy link
Copy Markdown

Fixes #2709.

participationclass divided number_of_voters by number_of_participants without a guard, so loading the results page for an evaluation with zero participants raised ZeroDivisionError. Returning 0 (the empty-bucket badge class) when number_of_participants is 0 mirrors the safe pattern already used in results/exporters.py:241 for the same ratio.

Added TestParticipationClassFilter covering the zero-participant case and the existing rounding behavior.

…aluation#2709)

participationclass divided number_of_voters by number_of_participants
without a guard, so evaluations with zero participants raised
ZeroDivisionError when the results template tried to render the
participants badge. Return 0 (the empty-bucket class) up front when
number_of_participants is 0; this matches the safe pattern already
used in exporters.py for the same ratio.
@niklasmohrin

Copy link
Copy Markdown
Member

Someone else is already working on this in #2713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ZeroDivisionError in results_templatetags

2 participants