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> <script type="text/javascript" src="/static/javascript/assignment.js"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% trans "Election" %}: <h1>{% trans "Election" %}: {{ item.assignment }}</h1>
<h1>{{ item.assignment }}</h1>
<div id="sidebar"> <div id="sidebar">
<div class="box"> <div class="box">
<h4>{% trans "Status" %}:</h4> <p><b>{% trans "Status" %}:</b><br>
{% trans item.assignment.get_status_display %} {% trans item.assignment.get_status_display %}</p>
{% if item.assignment.status == "sea" or item.assignment.status == "vot" %} {% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
<h4>{% trans "Number of available posts" %}:</h4> <p><b>{% trans "Number of available posts" %}:</b><br>
{{ item.assignment.posts }} {{ item.assignment.posts }}</p>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -70,12 +68,24 @@
{% else %}&empty;{% endif %} {% else %}&empty;{% endif %}
</td> </td>
{% endfor %} {% endfor %}
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<td {% if item.assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td> <td {% if item.assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
</tr> </tr>
{% endfor %} {% 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> </table>
{% endif %} {% endif %}

View File

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

View File

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