From 0b17ab10fed4dba118c4528f411c2d75777eb206 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Mon, 5 Sep 2011 20:47:55 +0200 Subject: [PATCH] Fixed candidates order in beamer view. Some style changes. --- openslides/agenda/templates/beamer.html | 1 + .../templates/beamer/ItemAssignment.html | 15 ++++++-- openslides/agenda/views.py | 35 ++++++++----------- .../assignment/templates/assignment/view.html | 1 + 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/openslides/agenda/templates/beamer.html b/openslides/agenda/templates/beamer.html index e1c64cc9d..aa9951a66 100644 --- a/openslides/agenda/templates/beamer.html +++ b/openslides/agenda/templates/beamer.html @@ -5,6 +5,7 @@ {% load tags %} + {% block title %} {% get_config 'event_name' %} {% endblock %} diff --git a/openslides/agenda/templates/beamer/ItemAssignment.html b/openslides/agenda/templates/beamer/ItemAssignment.html index 98157b4c7..dec55d4a4 100644 --- a/openslides/agenda/templates/beamer/ItemAssignment.html +++ b/openslides/agenda/templates/beamer/ItemAssignment.html @@ -44,13 +44,24 @@ {% for vote in votes %} - {% for v in vote %} - {% if v %} + + {% with vote|first as candidate %} + {{ candidate.0 }} + {% if candidate.1 %} + {% trans 'not elected' %} + {% else %} + {% trans 'elected' %} + {% endif %} + {% endwith %} + + {% for v in vote|last %} + {% if v %} {% if v|length == 3 %} {% if v.0 %}{{ v.0 }}{% else %}∅{% endif %}
{% if v.1 %}{{ v.1 }}{% else %}∅{% endif %}
{% if v.2 %}{{ v.2 }}{% else %}∅{% endif %}
{% else %} + {% if v != "-" %}{% endif %} {{ v }} {% endif %} {% else %}∅{% endif %} diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 57257f1c6..96696eff7 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -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 diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index d30a23051..d8ccb6b97 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -160,6 +160,7 @@ {% if v.1 %}{{ v.1 }}{% else %}∅{% endif %}
{% if v.2 %}{{ v.2 }}{% else %}∅{% endif %}
{% else %} + {% if v != "-" %}{% endif %} {{ v }} {% endif %} {% else %}∅{% endif %}