-
Notifications
You must be signed in to change notification settings - Fork 0
/
rcv-summary.html
53 lines (53 loc) · 2.19 KB
/
rcv-summary.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!-- contest: "{{ _metadata['contest_name'] }}" -->
<table class='table table-striped table-bordered table-condensed'>
<thead>
{%- set multiple_rounds = highest_round != 1 %}
<tr>
<th class='col-xs-6 col-md-6' align='left'></th>
<th class='col-xs-3 col-md-3' align='center' data-defaultsort='disabled'>{{ 'round'|TL }} 1{%- if not multiple_rounds %} ({{ 'round_final'|TL }}){%- endif %}</th>
{%- if multiple_rounds %}
<th class='col-xs-3 col-md-3' align='center'>{{ 'round'|TL }} {{ highest_round }} ({{ 'round_final'|TL }})</th>
{%- endif %}
</tr>
</thead>
<tbody>
{%- for candidate in candidate_names %}
{%- set round_1 = rounds[candidate][0] %}
{#- Subtract 1 to get a 0-based index. #}
{%- set round_last = rounds[candidate][highest_round - 1] %}
{%- set candidate_class = 'leading-candidate' if is_contest_leader(candidate) else '' %}
{%- set candidate_summary = candidate_summaries[candidate] %}
{%- set elimination_round = candidate_summary['elimination_round'] %}
<tr>
<td id='candidate'><span class='{{ candidate_class }}'>{{ candidate }}</span></td>
<td align='right'><span class='{{ candidate_class if highest_round == 1 else "" }}'>
({{ round_1['percent']|format_percent }}) {{ round_1['votes']|format_int }}
</span></td>
{%- if multiple_rounds %}
<td align='right'><span class='{{ candidate_class }}'>
{%- if elimination_round -%}
<em>eliminated in Round {{ elimination_round }}</em>
{%- else -%}
({{ round_last['percent']|format_percent }}) {{ round_last['votes']|format_int }}
{%- endif -%}
</span></td>
{%- endif %}
</tr>
{%- endfor %}
</tbody>
{#- Display the non-candidate totals after the candidate totals. #}
<tfoot>
{% for non_candidate_name in non_candidate_names %}
{%- set round_1 = rounds[non_candidate_name][0] %}
{#- Subtract 1 to get a 0-based index. #}
{%- set round_last = rounds[non_candidate_name][highest_round - 1] -%}
<tr>
<td id='candidate'><span class="election-tooltip" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ non_candidate_name|TST }}">{{ non_candidate_name|TS }}</span></td>
<td align='right'>{{ round_1['votes']|format_int }}</td>
{%- if multiple_rounds %}
<td align='right'>{{ round_last['votes']|format_int }}</td>
{%- endif %}
</tr>
{%- endfor %}
</tfoot>
</table>