summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2010-06-08 09:13:21 +0000
committeretienne2010-06-08 09:13:21 +0000
commit1963a111cb90d3bdb32749a18c3fd5c3d351c161 (patch)
tree76bc869ae12c2306bc8309e2001ebcbd79249029
parentb1c2eaab6b1628bd39482e281b34e04f8ecd19e4 (diff)
Correct sort bug
-rw-r--r--papillon/polls/views.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/papillon/polls/views.py b/papillon/polls/views.py
index e9ef572..300b313 100644
--- a/papillon/polls/views.py
+++ b/papillon/polls/views.py
@@ -455,8 +455,7 @@ def poll(request, poll_url):
if choice.id not in choice_vote_ids:
vote = Vote(voter=voter, choice=choice, value=None)
vote.save()
- idx = choices.index(choice)
- voter.votes.insert(idx, vote)
+ voter.votes.sort(lambda x, y : cmp(choices.index(x.choice), choices.index(y.choice)))
sums = [choice.getSum(poll.type == 'B') for choice in choices]
vote_max = max(sums)
c_idx = 0