fix problem by the assignment-poll view
This commit is contained in:
parent
6c66e55fc0
commit
5311c7ae31
@ -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':
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user