From 132b0561bd64607d7af193f83f21c50f3ec61609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20J=C3=BClg?= <tobias.juelg@tum.de> Date: Sat, 7 May 2022 14:39:55 +0200 Subject: [PATCH] Fixes issue #44 --- management/views.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/management/views.py b/management/views.py index 475dede..489e81e 100644 --- a/management/views.py +++ b/management/views.py @@ -414,11 +414,17 @@ def export_csv(request, pk): if e.max_votes_yes is not None: header.append('elected') writer.writerow(header) - for i, applicant in enumerate(e.election_summary): - row = [i + 1, applicant.get_display_name(), applicant.email, applicant.votes_accept, applicant.votes_reject, + nr_elected = 0 + for idx, applicant in enumerate(e.election_summary): + row = [idx + 1, applicant.get_display_name(), applicant.email, applicant.votes_accept, applicant.votes_reject, applicant.votes_abstention] if e.max_votes_yes is not None: - row.append(i < e.max_votes_yes) + if applicant.votes_accept > applicant.votes_reject and nr_elected < e.max_votes_yes: + # elected if: more yes than no, within the persons with the most yes votes + row.append(True) + nr_elected += 1 + else: + row.append(False) writer.writerow(row) return response -- GitLab