Show assignment vote results on projector view.

This commit is contained in:
Emanuel Schuetze 2011-09-07 23:25:59 +02:00
parent c53e5267c5
commit 1f5d86a0fc
3 changed files with 35 additions and 9 deletions

View File

@ -5,17 +5,15 @@
<script type="text/javascript" src="/static/javascript/assignment.js"></script>
{% endblock %}
{% block content %}
{% trans "Election" %}:
<h1>{{ item.assignment }}</h1>
<h1>{% trans "Election" %}: {{ item.assignment }}</h1>
<div id="sidebar">
<div class="box">
<h4>{% trans "Status" %}:</h4>
{% trans item.assignment.get_status_display %}
<p><b>{% trans "Status" %}:</b><br>
{% trans item.assignment.get_status_display %}</p>
{% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
<h4>{% trans "Number of available posts" %}:</h4>
{{ item.assignment.posts }}
<p><b>{% trans "Number of available posts" %}:</b><br>
{{ item.assignment.posts }}</p>
{% endif %}
</div>
</div>
@ -76,6 +74,18 @@
<td {% if item.assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
</tr>
{% endfor %}
<tr>
<td>{%trans 'Invalid votes' %}</td>
{% for p in polls %}
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
{% endfor %}
</tr>
<tr class="total">
<td><b>{%trans 'Votes cast' %}</b></td>
{% for p in polls %}
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
{% endfor %}
</tr>
</table>
{% endif %}

View File

@ -37,12 +37,13 @@ def view(request, item_id):
"""
item = Item.objects.get(id=item_id)
votes = assignment_votes(item)
polls = assignment_polls(item)
return render_to_response('beamer/%s.html' % item.type,
{
'item': item.cast(),
'ajax': 'off',
'votes': votes,
'polls': polls,
},
context_instance=RequestContext(request))
@ -57,6 +58,7 @@ def beamer(request):
try:
item = get_active_item()
votes = assignment_votes(item)
polls = assignment_polls(item)
if is_summary():
items = item.children.filter(hidden=False)
data['items'] = items
@ -66,6 +68,7 @@ def beamer(request):
data['item'] = item.cast()
data['title'] = item.title
data['votes'] = votes
data['polls'] = polls
template = 'beamer/%s.html' % (item.type)
except Item.DoesNotExist:
items = Item.objects.filter(parent=None).filter(hidden=False) \
@ -124,6 +127,14 @@ def assignment_votes(item):
return votes
def assignment_polls(item):
polls = []
if item.type == "ItemAssignment":
for poll in item.cast().assignment.poll_set.filter(assignment=item.cast().assignment):
polls.append(poll)
return polls
@permission_required('agenda.can_see_agenda')
@template('agenda/overview.html')
def overview(request):

View File

@ -149,3 +149,8 @@ table td {
padding: 10px 10px;
vertical-align:middle;
}
tr.total td {
border-top: 1px solid #333333;
background-color: #e3e3e3;
}