Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
only count the latest ratings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Aug 5, 2010
1 parent 76d89cc commit 7dad884
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/reviews/models.py
Expand Up @@ -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)]
Expand Down

0 comments on commit 7dad884

Please sign in to comment.