diff --git a/files/routes/users.py b/files/routes/users.py index ac211c3efd..998e7ce73b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -18,16 +18,6 @@ if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key db = db_session() -votes1 = db.query(Vote.user_id, func.count(Vote.user_id)).filter(Vote.vote_type==1).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() -votes2 = db.query(CommentVote.user_id, func.count(CommentVote.user_id)).filter(CommentVote.vote_type==1).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).all() -votes3 = Counter(dict(votes1)) + Counter(dict(votes2)) -users14 = db.query(User).filter(User.id.in_(votes3.keys())).all() -users15 = [] -for user in users14: - users15.append((user, votes3[user.id]-user.post_count-user.comment_count)) -users15 = sorted(users15, key=lambda x: x[1], reverse=True)[:25] -userss15 = users15[:25] - users = db.query(User) users1 = users.order_by(User.coins.desc()).limit(25).all() @@ -75,6 +65,16 @@ if SITE == 'rdrama.net': userss13 = users13[:25] else: userss13 = None +votes1 = db.query(Vote.user_id, func.count(Vote.user_id)).filter(Vote.vote_type==1).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() +votes2 = db.query(CommentVote.user_id, func.count(CommentVote.user_id)).filter(CommentVote.vote_type==1).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).all() +votes3 = Counter(dict(votes1)) + Counter(dict(votes2)) +users14 = db.query(User).filter(User.id.in_(votes3.keys())).all() +users15 = [] +for user in users14: + users15.append((user, votes3[user.id]-user.post_count-user.comment_count)) +users15 = sorted(users15, key=lambda x: x[1], reverse=True)[:25] +userss15 = users15[:10] + db.close() @app.get("/grassed") diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 31e153b664..59a2275e09 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -408,7 +408,7 @@ {{user[1]}} {% endfor %} - {% if pos15 and pos15[0] > 25 %} + {% if pos15 and pos15[0] > 10 %} {{pos15[0]}} @{{v.username}}'s profile picture{{v.username}}