From a21a96026b02447100a75eb08b7eb6a187801094 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Mon, 2 Jul 2012 20:32:13 +0200 Subject: [PATCH] fix yes-no-abstain-poll in assigmnet-projector --- openslides/assignment/models.py | 10 +++-- .../templates/projector/Assignment.html | 41 +++++++++++-------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 1dcbec92c..dfb69d6c5 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -113,9 +113,13 @@ class Assignment(models.Model, SlideMixin): publish_winner_results_only = config["assignment_publish_winner_results_only"] # list of votes votes = [] - for candidate in self.candidates: + options = [] + polls = self.poll_set.all() + for poll in polls: + options += poll.get_options() + for candidate in set([option.candidate for option in options]): tmplist = [[candidate, self.is_elected(candidate)], []] - for poll in self.poll_set.all(): + for poll in polls: if poll.published: if poll.get_options().filter(candidate=candidate).exists(): # check config option 'publish_winner_results_only' @@ -123,7 +127,7 @@ class Assignment(models.Model, SlideMixin): or publish_winner_results_only and self.is_elected(candidate): option = AssignmentOption.objects.filter(poll=poll).get(candidate=candidate) try: - tmplist[1].append(option.get_votes()[0]) + tmplist[1].append(option.get_votes()) except IndexError: tmplist[1].append('–') else: diff --git a/openslides/assignment/templates/projector/Assignment.html b/openslides/assignment/templates/projector/Assignment.html index 8038a12fd..3d9e021e1 100644 --- a/openslides/assignment/templates/projector/Assignment.html +++ b/openslides/assignment/templates/projector/Assignment.html @@ -46,7 +46,7 @@


{% endif %} - {% if polls.count > 0 %} + {% if polls.exists %}

{% trans "Election results" %}

@@ -60,25 +60,30 @@ {% for vote in votes %} {% with vote|first as candidate %} - - {% for v in vote|last %} - + {% for v in vote|last %} + - {% endfor %} + + {% endfor %} {% endwith %} {% empty %}
- {% if candidate.1 %} - - {% endif %} - {{ candidate.0 }} - {% 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 }} +
+ {% if candidate.1 %} + + + + {% endif %} + {{ candidate.0 }} + + {% 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.0 }} {% endif %} {% endif %} -