fedora_elections/models.py | 7 +++++++
fedora_elections/templates/results.html | 2 +-
fedora_elections/templates/results_text.html | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 88b340563c8ee5bf5bbbfc6a397dccc2f07d5bf1
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Jul 26 12:43:31 2014 +0200
Adjust calculating the maximum number of votes to use `max_vote`
diff --git a/fedora_elections/templates/results.html
b/fedora_elections/templates/results.html
index c4581b1..9183faf 100644
--- a/fedora_elections/templates/results.html
+++ b/fedora_elections/templates/results.html
@@ -68,7 +68,7 @@
</tr>
<tr>
<th title="Maximum number of votes possible">Maximum of
votes</th>
- <td>{{ stats['n_voters'] * stats['n_candidates']
}}</td>
+ <td>{{ stats['n_voters'] * stats['max_vote']
}}</td>
</tr>
{% if stats['candidate_voters'] %}
<tr>
diff --git a/fedora_elections/templates/results_text.html
b/fedora_elections/templates/results_text.html
index 59fbba0..f3947ec 100644
--- a/fedora_elections/templates/results_text.html
+++ b/fedora_elections/templates/results_text.html
@@ -16,7 +16,7 @@ are shown below.
XXX is electing {{ election.seats_elected }} seats this time.
A total of {{stats['n_voters'] }} ballots were cast, meaning a candidate
-could accumulate up to {{ stats['n_voters'] * stats['n_candidates'] }}
votes ({{stats['n_voters'] }} * {{ stats['n_candidates'] }}).
+could accumulate up to {{ stats['n_voters'] * stats['max_vote'] }} votes
({{stats['n_voters'] }} * {{ stats['max_vote'] }}).
The results for the elections are as follows:
commit 9e82fe2336d0f4790f30b06a65968a688516f232
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Sat Jul 26 12:43:02 2014 +0200
Add a `max_vote` entry in the stats table used for the result page
diff --git a/fedora_elections/models.py b/fedora_elections/models.py
index d35096f..1cc51f4 100644
--- a/fedora_elections/models.py
+++ b/fedora_elections/models.py
@@ -414,6 +414,13 @@ class Vote(BASE):
stats['candidate_voters'] = candidate_voters
stats['n_candidates'] = cnt
+ if election.voting_type in ['range', 'select']:
+ stats['max_vote'] = cnt
+ if election.max_votes:
+ stats['max_vote'] = election.max_votes
+ elif election.voting_type == 'simple':
+ stats['max_vote'] = 1
+
return stats
Show replies by date