On utilise l'abbréviation dans les résultats

This commit is contained in:
Tom Hubrecht 2021-04-17 08:37:23 +02:00
parent 15f160a0e6
commit bd968d55c1
4 changed files with 9 additions and 7 deletions

View file

@ -206,7 +206,7 @@
<span class="icon"> <span class="icon">
<i class="fas fa-layer-group"></i> <i class="fas fa-layer-group"></i>
</span> </span>
<span>{{ forloop.counter }}</span> <span>{% if o.abbreviation %}{{ o.abbreviation }}{% else %}{{ forloop.counter }}{% endif %}</span>
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}

View file

@ -226,7 +226,7 @@
<span class="icon"> <span class="icon">
<i class="fas fa-layer-group"></i> <i class="fas fa-layer-group"></i>
</span> </span>
<span>{{ forloop.counter }}</span> <span>{% if o.abbreviation %}{{ o.abbreviation }}{% else %}{{ forloop.counter }}{% endif %}</span>
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}

View file

@ -10,20 +10,20 @@
<i class="fas fa-undo-alt"></i> <i class="fas fa-undo-alt"></i>
</span> </span>
</th> </th>
{% for i in range %} {% for o in options %}
<th class="has-text-centered"> <th class="has-text-centered">
<span class="icon-text"> <span class="icon-text">
<span class="icon"> <span class="icon">
<i class="fas fa-layer-group"></i> <i class="fas fa-layer-group"></i>
</span> </span>
<span>{{ i }}</span> <span>{% if o.abbreviation %}{{ o.abbreviation }}{% else %}{{ forloop.counter }}{% endif %}</span>
</span> </span>
</th> </th>
{% endfor %} {% endfor %}
</thead> </thead>
<tbody> <tbody>
{% for line in matrix %} {% for line, o in matrix %}
{% with loser=forloop.counter %} {% with loser=forloop.counter %}
<tr> <tr>
<th class="has-text-centered"> <th class="has-text-centered">
@ -31,7 +31,7 @@
<span class="icon"> <span class="icon">
<i class="fas fa-layer-group"></i> <i class="fas fa-layer-group"></i>
</span> </span>
<span>{{ forloop.counter }}</span> <span>{% if o.abbreviation %}{{ o.abbreviation }}{% else %}{{ forloop.counter }}{% endif %}</span>
</span> </span>
</th> </th>

View file

@ -265,9 +265,11 @@ class ResultsData:
else: else:
matrix[i, j] = (_matrix[i, j], "") matrix[i, j] = (_matrix[i, j], "")
matrix = zip(matrix.tolist(), options)
return render_to_string( return render_to_string(
"elections/results/rank.html", "elections/results/rank.html",
{"q": question, "matrix": matrix, "range": range(1, n + 1)}, {"q": question, "matrix": matrix, "options": options},
) )