From 5311c7ae318d638db1131c3b2cd0d47b8cef805e Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 24 Jun 2012 23:31:06 +0200 Subject: [PATCH] fix problem by the assignment-poll view --- openslides/assignment/models.py | 3 ++- openslides/assignment/views.py | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 1b7d178a8..d92261bc7 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -107,6 +107,7 @@ class Assignment(models.Model, SlideMixin): @property def vote_results(self): + # TODO: Rewrite this code. Use a matrix and transform it. votes = [] publish_winner_results_only = config["assignment_publish_winner_results_only"] # list of votes @@ -190,7 +191,7 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin): return self.assignment def get_vote_values(self): - if not self.yesnoababstain: + if self.yesnoababstain is None: if config['assignment_poll_vote_values'] == 'votes': self.yesnoababstain = False elif config['assignment_poll_vote_values'] == 'yesnoabstain': diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 4c2142b4c..7732492f1 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -84,9 +84,14 @@ def view(request, assignment_id=None): if request.user.has_perm('assignment.can_nominate_other'): form = AssignmentRunForm() + # why not use assignment.vote_results? polls = assignment.poll_set.all() votes = [] - for candidate in assignment.candidates: + options = [] + for poll in polls: + options += poll.get_options() + + for candidate in set([option.candidate for option in options]): tmplist = ((candidate, assignment.is_elected(candidate)), []) for poll in polls: if (poll.published and not request.user.has_perm('assignment.can_manage_assignment')) or request.user.has_perm('assignment.can_manage_assignment'): @@ -100,7 +105,6 @@ def view(request, assignment_id=None): else: tmplist[1].append("-") votes.append(tmplist) - return { 'assignment': assignment, 'form': form,