diff --git a/election/models.py b/election/models.py
index c6df8537..00ca2f46 100644
--- a/election/models.py
+++ b/election/models.py
@@ -57,10 +57,10 @@ class Election(models.Model):
return False
@property
- def get_results(self):
+ def results(self):
results = {}
for role in self.role.all():
- results[role.title] = role.get_results
+ results[role.title] = role.results
return results
# Permissions
@@ -80,7 +80,7 @@ class Role(models.Model):
return self.has_voted.filter(id=user.id).exists()
@property
- def get_results(self):
+ def results(self):
results = {}
total_vote = self.has_voted.count() * self.max_choice
if total_vote == 0:
diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja
index 02334bf4..c5e5fbfd 100644
--- a/election/templates/election/election_detail.jinja
+++ b/election/templates/election/election_detail.jinja
@@ -87,14 +87,18 @@ th {
}
.list-per-role__candidate:not(:last-child) {
- margin-bottom: 5px;
+ margin-bottom: 15px;
}
-.candidate {
+.candidate__infos {
display: flex;
flex-flow: row nowrap;
}
+.candidate__infos:not(:last-child) {
+ margin-bottom: 5px;
+}
+
.candidate__picture-wrapper {
display: flex;
justify-content: center;
@@ -113,7 +117,7 @@ th {
max-height: 150px;
}
-.candidate__infos {
+.candidate__details {
margin-left: 5px;
}
@@ -184,6 +188,10 @@ th {
background: indianred;
}
+.election__results {
+ text-align: center;
+}
+
.election__sumbit-section {
margin-bottom: 5px;
}
@@ -251,9 +259,7 @@ th {
{%- set election_lists = election.election_list.all() -%}
- {%- if not election.has_voted(user) and election.can_vote(user) %}
{% trans %}Blank vote{% endtrans %} |
- {%- endif %}
{%- for election_list in election_lists %}
{{election_list.title}} |
{%- endfor %}
@@ -276,29 +282,33 @@ th {
- {%- if election.can_vote(user) %}
- {%- if role.max_choice == 1 %}
+ {%- if role.max_choice == 1 and election.can_vote(user) %}
{%- set _ = count.append(count.pop() + 1) %}
{%- endif %}
+ {%- if election.has_voted(user) or not election.is_vote_active %}
+ {%- set results = election_results[role.title]['blank vote'] %}
+
+ {{results.vote}} {% trans %}votes{% endtrans %} ( {{results.percent}} %)
+
+ {%- endif %}
|
- {%- endif %}
{%- for election_list in election_lists %}
{%- for candidature in election_list.candidature.filter(role=role) %}
- -
-
|