On trie les bulletins avant l'affichage

This commit is contained in:
Tom Hubrecht 2021-07-10 19:56:45 +02:00
parent ba863c757f
commit b79a7f6b0f
3 changed files with 5 additions and 4 deletions

View file

@ -9,7 +9,7 @@
</thead> </thead>
<tbody> <tbody>
{% for ballot in ballots.values %} {% for ballot in ballots %}
<tr> <tr>
{% for r in ballot %} {% for r in ballot %}
<td class="has-text-centered">{{ r }}</td> <td class="has-text-centered">{{ r }}</td>

View file

@ -9,7 +9,7 @@
</thead> </thead>
<tbody> <tbody>
{% for ballot in ballots.values %} {% for ballot in ballots %}
<tr> <tr>
{% for v in ballot %} {% for v in ballot %}
<td class="has-text-centered"> <td class="has-text-centered">

View file

@ -285,7 +285,8 @@ class BallotsData:
ballots[v.user] = ballot ballots[v.user] = ballot
return render_to_string( return render_to_string(
"elections/ballots/select.html", {"options": options, "ballots": ballots} "elections/ballots/select.html",
{"options": options, "ballots": sorted(ballots.values(), reverse=True)},
) )
def rank(question): def rank(question):
@ -307,7 +308,7 @@ class BallotsData:
return render_to_string( return render_to_string(
"elections/ballots/rank.html", "elections/ballots/rank.html",
{"options": options, "ballots": ranks_by_user}, {"options": options, "ballots": sorted(ranks_by_user.values())},
) )