From d0bd32edea3092a8f4b2850183d4c54da2ad28dd Mon Sep 17 00:00:00 2001 From: hernani Date: Fri, 7 May 2010 11:23:28 +0000 Subject: [PATCH 1/1] Fixed http://jira.osqa.net/browse/OSQA-217. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@158 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/views/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/forum/views/admin.py b/forum/views/admin.py index 490244f..94e5da9 100644 --- a/forum/views/admin.py +++ b/forum/views/admin.py @@ -158,12 +158,12 @@ def go_defaults(request): def recalculate_denormalized(request): for n in Node.objects.all(): n = n.leaf - n.vote_up_count = n.votes.filter(canceled=False, vote=1).count() - n.vote_down_count = n.votes.filter(canceled=False, vote=-1).count() + n.score = n.votes.aggregate(score=Sum('value'))['score'] + if not n.score: n.score = 0 n.save() for u in User.objects.all(): - u.reputation = u.reputes.filter(canceled=False).aggregate(reputation=Sum('value'))['reputation'] + u.reputation = u.reputes.aggregate(reputation=Sum('value'))['reputation'] u.save() request.user.message_set.create(message=_('All values recalculated')) -- 2.39.5