From 1963a111cb90d3bdb32749a18c3fd5c3d351c161 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 8 Jun 2010 09:13:21 +0000 Subject: Correct sort bug --- papillon/polls/views.py | 3 +-- 1 file changed, 1 insertion(+), 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 -- cgit v1.2.3