Draft for vote result table on assignment view and projector. Publishing still not working.
This commit is contained in:
parent
2dc0cc83f1
commit
ad02cb05ae
@ -157,7 +157,7 @@ class Assignment(models.Model, SlideMixin):
|
|||||||
data['assignment'] = self
|
data['assignment'] = self
|
||||||
data['title'] = self.name
|
data['title'] = self.name
|
||||||
data['polls'] = self.poll_set.all()
|
data['polls'] = self.poll_set.all()
|
||||||
data['votes'] = self.vote_results
|
data['vote_results'] = self.vote_results
|
||||||
data['template'] = 'projector/Assignment.html'
|
data['template'] = 'projector/Assignment.html'
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
|
|
||||||
{% if polls %}
|
{% if polls %}
|
||||||
<table id="election_table" style="width: auto;">
|
<table id="election_table" style="width: auto;">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
{% with ballotnumber=polls.count %}
|
{% with ballotnumber=polls.count %}
|
||||||
@ -107,10 +108,11 @@
|
|||||||
</th>
|
</th>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Candidates" %}</th>
|
<th>{% trans "Candidates" %}</th>
|
||||||
{% for poll in polls %}
|
{% for poll in polls %}
|
||||||
{# if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment #}
|
{% if poll.published or perms.assignment.can_manage_assignment %}
|
||||||
<th style="vertical-align: top; white-space:nowrap;">
|
<th style="vertical-align: top; white-space:nowrap;">
|
||||||
{{ forloop.counter }}. {% trans 'ballot' %}
|
{{ forloop.counter }}. {% trans 'ballot' %}
|
||||||
{% if perms.assignment.can_manage_assignment %}
|
{% if perms.assignment.can_manage_assignment %}
|
||||||
@ -124,7 +126,7 @@
|
|||||||
<a href="{% url assignment_poll_delete poll.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete' %}"></a>
|
<a href="{% url assignment_poll_delete poll.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
{# endif #}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<th>
|
<th>
|
||||||
@ -136,6 +138,7 @@
|
|||||||
</th>
|
</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for candidate, votes in vote_results.items %}
|
{% for candidate, votes in vote_results.items %}
|
||||||
<tr class="{% cycle 'odd' '' %}">
|
<tr class="{% cycle 'odd' '' %}">
|
||||||
<td class="candidate">
|
<td class="candidate">
|
||||||
@ -153,29 +156,33 @@
|
|||||||
{{ candidate }}
|
{{ candidate }}
|
||||||
</td>
|
</td>
|
||||||
{% for vote in votes %}
|
{% for vote in votes %}
|
||||||
|
{% if perms.assignment.can_manage_assignment %}
|
||||||
|
{# Hier stimmt es noch nicht. Es muss rein, dass veröffentlichte Wahlergebnisse für jedermann sichtbar sind #}
|
||||||
<td style="white-space:nowrap;">
|
<td style="white-space:nowrap;">
|
||||||
{% if vote %}
|
|
||||||
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
|
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
|
||||||
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if vote.Yes %}{{ vote.Yes }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
|
||||||
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {% if vote.No %}{{ vote.No }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
|
||||||
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {% if vote.Abstain %}{{ vote.Abstain }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
|
||||||
{% elif 'Votes' in vote %}
|
{% elif 'Votes' in vote %}
|
||||||
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if vote.Votes %}{{ vote.Votes }}{% else %}∅{% endif %}
|
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
|
||||||
{% endif %}
|
{% elif vote == None %}
|
||||||
|
{% trans 'was not a <br> candidate'%}
|
||||||
{% else %}
|
{% else %}
|
||||||
–
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{%trans 'Invalid votes' %}</td>
|
<td>{%trans 'Invalid votes' %}</td>
|
||||||
{% for poll in polls %}
|
{% for poll in polls %}
|
||||||
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
{% if poll.published or perms.assignment.can_manage_assignment %}
|
||||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
|
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -183,10 +190,11 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td><b>{%trans 'Votes cast' %}</b></td>
|
<td><strong>{%trans 'Votes cast' %}</strong></td>
|
||||||
{% for poll in polls %}
|
{% for poll in polls %}
|
||||||
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
{% if poll.published or perms.assignment.can_manage_assignment %}
|
||||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <strong>{{ poll.print_votescast }}</strong></td>
|
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <strong>{{ poll.print_votescast }}</strong></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
{% if polls.exists %}
|
{% if polls.exists %}
|
||||||
<h3>{% trans "Election results" %}</h3>
|
<h3>{% trans "Election results" %}</h3>
|
||||||
<table>
|
<table>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Candidates" %}</th>
|
<th>{% trans "Candidates" %}</th>
|
||||||
{% for poll in assignment.poll_set.all %}
|
{% for poll in assignment.poll_set.all %}
|
||||||
@ -57,58 +58,57 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for vote in votes %}
|
|
||||||
|
{% for candidate, votes in vote_results.items %}
|
||||||
<tr class="{% cycle 'odd' '' %}">
|
<tr class="{% cycle 'odd' '' %}">
|
||||||
{% with vote|first as candidate %}
|
|
||||||
<td class="candidate{% if candidate.1 %} elected{% endif %}">
|
<td class="candidate{% if candidate.1 %} elected{% endif %}">
|
||||||
{% if candidate.1 %}
|
{% if candidate in assignment.elected.all %}
|
||||||
<a class="elected">
|
<a class="elected">
|
||||||
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
|
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ candidate.0 }}
|
{{ candidate }}
|
||||||
</td>
|
</td>
|
||||||
{% for v in vote|last %}
|
{% for vote in votes %}
|
||||||
<td style="white-space:nowrap;" {% if candidate.1 %}class="elected"{% endif %}>
|
{# Hier stimmt es noch nicht. Es muss rein, dass nur veröffentlichte Wahlergebnisse angezeigt werden sollen #}
|
||||||
{% if v %}
|
<td style="white-space:nowrap;"{% if candidate in assignment.elected.all %} class="elected"{% endif %}>
|
||||||
{% if v|length == 3 %}
|
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
|
||||||
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
|
||||||
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
|
||||||
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}∅{% endif %}<br>
|
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
|
||||||
|
{% elif 'Votes' in vote %}
|
||||||
|
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
|
||||||
|
{% elif vote == None %}
|
||||||
|
{% trans 'was not a <br> candidate'%}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if v != "-" %}
|
|
||||||
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}">
|
|
||||||
{% endif %}
|
|
||||||
{{ v.0 }}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endwith %}
|
|
||||||
</tr>
|
|
||||||
{% empty %}
|
|
||||||
<tr>
|
|
||||||
<td {% if assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{%trans 'Invalid votes' %}</td>
|
<td>{%trans 'Invalid votes' %}</td>
|
||||||
{% for p in polls %}
|
{% for poll in polls %}
|
||||||
{% if p.published %}
|
{% if poll.published %}
|
||||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ p.print_votesinvalid }}</td>
|
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td><b>{%trans 'Votes cast' %}</b></td>
|
<td><b>{%trans 'Votes cast' %}</b></td>
|
||||||
{% for p in polls %}
|
{% for poll in polls %}
|
||||||
{% if p.published %}
|
{% if poll.published %}
|
||||||
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ p.print_votescast }}</b></td>
|
<td style="white-space:nowrap;"><img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <b>{{ poll.print_votescast }}</b></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
{% elif assignment.profile.exists %}
|
||||||
|
<i>{% trans "No ballots available." %}</i>
|
||||||
|
{% endif %}
|
||||||
<br>
|
<br>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user