-
Notifications
You must be signed in to change notification settings - Fork 6
/
results.html
45 lines (43 loc) · 1.53 KB
/
results.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
---
title: Election Results
---
{% capture dates %}{% for e in site.data.popolo-data.elections %}{{e[1].end_date}}|{%endfor%}{% endcapture %}
{% assign sorted_dates = dates | split: "|" | uniq | sort | reverse %}
<table class='table table-striped'>
<tr>
<th>Date</th>
<th>Body</th>
<th>Area</th>
<th>Name</th>
<th>Votes</th>
<th>Share</th>
<th>Won</th>
</tr>
{% for date in sorted_dates %}
{% for e in site.data.popolo-data.elections %}
{% if e[1].end_date == date and e[1].result %}
{% assign id = e[0] %}
{% assign candidacy = site.data.popolo-data.candidacies[id] %}
{% assign parent_id = e[1].parent_id | remove: "." %}
{% assign parent = site.data.popolo-data.elections[parent_id] %}
{% assign candidate_id = candidacy.person_id %}
{% assign candidate = site.data.popolo-data.people[candidate_id] %}
<tr>
<td>{{ parent.end_date | date: "%d/%m/%Y"}}</td>
<td>{{ parent.organization }}</td>
<td>{{ e[1].location.name }}</td>
<td>{{ candidate.name }}</td>
<td><a href='{{ e[1].result.url }}'>{{ candidacy.result.votes }}</a></td>
<td>{{ candidacy.result.share | times: 100 | round: 2 }}%</td>
<td>
{% if candidacy.result.elected %}
<span class='label label-success'>Yes</span>
{% else %}
<span class='label label-danger'>No</span>
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</table>