Permalink
Browse files

Anonymous tags gone from leaderboard. Fixes #23

  • Loading branch information...
1 parent 3b155c8 commit fa644398af0a0cfa3c6cf2144d55b149dde20fc1 @ralphbean committed Jan 11, 2012
Showing with 6 additions and 2 deletions.
  1. +2 −1 fedoratagger/controllers/root.py
  2. +4 −1 fedoratagger/model/packages.py
@@ -130,7 +130,8 @@ def leaderboard(self, N=10):
Returns an HTML table of the top N users.
"""
- users = model.FASUser.query.all()
+ query = model.FASUser.query
+ users = query.filter(model.FASUser.username!='anonymous').all()
users.sort(lambda x, y: cmp(len(x.votes), len(y.votes)), reverse=True)
users = users[:N]
@@ -161,8 +161,11 @@ def total_votes(self):
@property
def rank(self):
+ if self.username == 'anonymous':
+ return -1
+
# TODO - there's a more optimal way to do this in SQL land.
- users = FASUser.query.all()
+ users = FASUser.query.filter(FASUser.username!='anonymous').all()
users.sort(lambda x, y: cmp(x.total_votes, y.total_votes), reverse=True)
return users.index(self) + 1

0 comments on commit fa64439

Please sign in to comment.