user-api: small fix for the second poll in assignment

This commit is contained in:
Oskar Hahn 2012-08-03 19:15:14 +02:00
parent 8fcf65e829
commit 2bc2dad7a5

View File

@ -131,7 +131,7 @@ class Assignment(models.Model, SlideMixin):
def set_elected(self, user, value=True): def set_elected(self, user, value=True):
candidate = AssignmentCandidate.objects.get(user=user) candidate = self.assignment_candidats.get(user=user)
candidate.elected = value candidate.elected = value
candidate.save() candidate.save()
@ -255,8 +255,7 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin):
self.yesnoabstain = True self.yesnoabstain = True
else: else:
# candidates <= available posts -> yes/no/abstain # candidates <= available posts -> yes/no/abstain
if self.assignment.assignment_candidats.filter(elected=False).count() <= (self.assignment.posts if self.assignment.assignment_candidats.filter(elected=False).count() <= (self.assignment.posts):
- self.assignment.assignment_candidats.filter(elected=True).count()):
self.yesnoabstain = True self.yesnoabstain = True
else: else:
self.yesnoabstain = False self.yesnoabstain = False