{% extends "base.html" %} {% block body %}

{{ election.shortdesc }} Results

{{ election.description }}

{% if election.url %}

[More Information]

{% endif %} {% for candidate in election.candidates|sort(attribute='vote_count', reverse=True) %} {% if loop.index <= election.seats_elected %} {# If we are below the number of user that will be selected, get the number of votes and the flag to False#} {% set flag = False %} {% set votes = candidate.vote_count %} {% elif loop.index > election.seats_elected and votes > candidate.vote_count and not flag %} {# if we are above the number of user that will be selected (seats available), check if the number of votes for this candidate is lower than the number of votes for the last candidate and if the Flag is False So this takes care of the case where there are 10 seats elected and the 11th candidate has the same score as the 10th one. In this case we would end up with one more person that the number of seats available and we'll need to either find a way to select one over the other or deal with having one more candidate accepted #} {% set flag = True %} {% set lastrow = True %} {% else %} {# we are above the number of seats available, the number of votes is below that of the last candidate above selected and the Flag is True which means we already passed the condition above #} {% set lastrow = False %} {% endif %} {% endfor %}
Candidate Votes
{% if election.candidates_are_fasusers %} {{ usernamemap['%s' % candidate.id] }} {% else %} {{candidate.name}} {% endif %} {% if candidate.url %} [info] {% endif %} {{ candidate.vote_count }}

Some statistics about this election

{% if stats['candidate_voters'] %} {% for candidate in election.candidates|sort(attribute='vote_count',reverse=True) %} {% if stats['candidate_voters'][candidate.name] %} {% else %} {% endif %} {% endfor %} {% endif %}
Number of seats elections {{ election.seats_elected }}
Number of voters {{ stats['n_voters'] }}
Number of votes {{ stats['n_votes'] }}
Maximum of votes {{ stats['n_voters'] * stats['max_vote'] }}
Number of voters per candidate Average votes per candidate
{{ candidate.name }} {{ stats['candidate_voters'][candidate.name] }}{{ candidate.vote_count / stats['candidate_voters'][candidate.name] }} -
{% endblock %}