]> git.openstreetmap.org Git - osqa.git/commitdiff
Fixed http://jira.osqa.net/browse/OSQA-217.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 7 May 2010 11:23:28 +0000 (11:23 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 7 May 2010 11:23:28 +0000 (11:23 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@158 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/admin.py

index 490244fde8419563459c9bb80b22edef0e9d3917..94e5da9eadaa453fb32dcb3b0b9b2eb3da9ca995 100644 (file)
@@ -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'))