Fixed candidates order in beamer view. Some style changes.

This commit is contained in:
Emanuel Schuetze 2011-09-05 20:47:55 +02:00
parent fec269e4a7
commit 0b17ab10fe
4 changed files with 30 additions and 22 deletions

View File

@ -5,6 +5,7 @@
{% load tags %}
<head>
<link type="text/css" rel="stylesheet" href="/static/styles/beamer.css">
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" />
<script type="text/javascript" src="/static/javascript/jquery.js"></script>
<script type="text/javascript" src="/static/javascript/beamer.js"></script>
<title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title>

View File

@ -44,13 +44,24 @@
</tr>
{% for vote in votes %}
<tr class="{% cycle 'odd' '' %}">
{% for v in vote %}
<td>{% if v %}
<td class="candidate">
{% with vote|first as candidate %}
{{ candidate.0 }}
{% if candidate.1 %}
{% trans 'not elected' %}
{% else %}
{% trans 'elected' %}
{% endif %}
{% endwith %}
</td>
{% for v in vote|last %}
<td style="white-space:nowrap;">{% if v %}
{% if v|length == 3 %}
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png">{% endif %}
{{ v }}
{% endif %}
{% else %}&empty;{% endif %}

View File

@ -106,26 +106,21 @@ def beamer_edit(request, direction):
def assignment_votes(item):
votes = []
if item.type == "ItemAssignment":
assignment = item.cast().assignment
# list of candidates
candidates = set()
for option in Option.objects.filter(poll__assignment=assignment):
candidates.add(option.value)
# list of votes
votes = []
for candidate in candidates:
tmplist = []
tmplist.append(candidate)
for poll in assignment.poll_set.all():
if candidate in poll.options_values:
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
if poll.optiondecision:
tmplist.append([option.yes, option.no, option.undesided])
else:
tmplist.append(option.yes)
else:
tmplist.append("-")
votes.append(tmplist)
assignment = item.cast().assignment
# list of votes
votes = []
for candidate in assignment.candidates:
tmplist = [[candidate, assignment.is_elected(candidate)], []]
for poll in assignment.poll_set.all():
if candidate in poll.options_values:
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
if poll.optiondecision:
tmplist[1].append([option.yes, option.no, option.undesided])
else:
tmplist[1].append(option.yes)
else:
tmplist[1].append("-")
votes.append(tmplist)
return votes

View File

@ -160,6 +160,7 @@
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png">{% endif %}
{{ v }}
{% endif %}
{% else %}&empty;{% endif %}