From 7dad884bcc7df218405693af9a144a5a87c61cfc Mon Sep 17 00:00:00 2001 From: Jeff Balogh Date: Thu, 5 Aug 2010 10:06:23 -0700 Subject: [PATCH] only count the latest ratings --- apps/reviews/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/reviews/models.py b/apps/reviews/models.py index a0a6468b464..3f725125e0e 100644 --- a/apps/reviews/models.py +++ b/apps/reviews/models.py @@ -183,7 +183,7 @@ def get(cls, addon): @classmethod def set(cls, addon, using=None): - q = (Review.objects.valid().filter(addon=addon).using(using) + q = (Review.objects.latest().filter(addon=addon).using(using) .values_list('rating').annotate(models.Count('rating'))) counts = dict(q) ratings = [(rating, counts.get(rating, 0)) for rating in range(1, 6)]