forked from MarseyWorld/MarseyWorld
fds
parent
7a766fb35b
commit
3de32a72ba
|
@ -42,37 +42,6 @@ if site == 'rdrama.net':
|
||||||
|
|
||||||
users = db.query(User)
|
users = db.query(User)
|
||||||
|
|
||||||
users1 = users.order_by(User.coins.desc()).all()
|
|
||||||
pos1 = users1.index(v)
|
|
||||||
users1 = users1[:25]
|
|
||||||
|
|
||||||
users2 = users.order_by(User.stored_subscriber_count.desc()).all()
|
|
||||||
pos2 = users2.index(v)
|
|
||||||
users2 = users2[:25]
|
|
||||||
|
|
||||||
users3 = users.order_by(User.post_count.desc()).all()
|
|
||||||
pos3 = users3.index(v)
|
|
||||||
users3 = users3[:25]
|
|
||||||
|
|
||||||
users4 = users.order_by(User.comment_count.desc()).all()
|
|
||||||
pos4 = users4.index(v)
|
|
||||||
users4 = users4[:25]
|
|
||||||
|
|
||||||
users5 = users.order_by(User.received_award_count.desc()).all()
|
|
||||||
pos5 = users5.index(v)
|
|
||||||
users5 = users5[:25]
|
|
||||||
|
|
||||||
if request.host == 'pcmemes.net':
|
|
||||||
users6 = users.order_by(User.basedcount.desc()).all()
|
|
||||||
pos6 = users6.index(v)
|
|
||||||
users6 = users6[:25]
|
|
||||||
else:
|
|
||||||
users6 = None
|
|
||||||
pos6 = None
|
|
||||||
|
|
||||||
users7 = users.order_by(User.coins_spent.desc()).all()
|
|
||||||
pos7 = users7.index(v)
|
|
||||||
users7 = users7[:25]
|
|
||||||
|
|
||||||
votes1 = db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
|
votes1 = db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
|
||||||
votes2 = db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
votes2 = db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||||
|
@ -82,10 +51,6 @@ users9 = []
|
||||||
for user in users8: users9.append((user, votes3[user.id]))
|
for user in users8: users9.append((user, votes3[user.id]))
|
||||||
users9 = sorted(users9, key=lambda x: x[1], reverse=True)[:25]
|
users9 = sorted(users9, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
users10 = db.query(User).order_by(User.truecoins.desc()).all()
|
|
||||||
pos10 = users10.index(v)
|
|
||||||
users10 = users10[:25]
|
|
||||||
|
|
||||||
badges = db.query(Badge.user_id, func.count(Badge.user_id)).group_by(Badge.user_id).order_by(func.count(Badge.user_id).desc()).all()
|
badges = db.query(Badge.user_id, func.count(Badge.user_id)).group_by(Badge.user_id).order_by(func.count(Badge.user_id).desc()).all()
|
||||||
badges = dict(badges)
|
badges = dict(badges)
|
||||||
users11 = db.query(User).filter(User.id.in_(badges.keys())).all()
|
users11 = db.query(User).filter(User.id.in_(badges.keys())).all()
|
||||||
|
@ -356,6 +321,42 @@ def transfer_bux(v, username):
|
||||||
@app.get("/leaderboard")
|
@app.get("/leaderboard")
|
||||||
@auth_required
|
@auth_required
|
||||||
def leaderboard(v):
|
def leaderboard(v):
|
||||||
|
users1 = users.order_by(User.coins.desc()).all()
|
||||||
|
pos1 = users1.index(v)
|
||||||
|
users1 = users1[:25]
|
||||||
|
|
||||||
|
users2 = users.order_by(User.stored_subscriber_count.desc()).all()
|
||||||
|
pos2 = users2.index(v)
|
||||||
|
users2 = users2[:25]
|
||||||
|
|
||||||
|
users3 = users.order_by(User.post_count.desc()).all()
|
||||||
|
pos3 = users3.index(v)
|
||||||
|
users3 = users3[:25]
|
||||||
|
|
||||||
|
users4 = users.order_by(User.comment_count.desc()).all()
|
||||||
|
pos4 = users4.index(v)
|
||||||
|
users4 = users4[:25]
|
||||||
|
|
||||||
|
users5 = users.order_by(User.received_award_count.desc()).all()
|
||||||
|
pos5 = users5.index(v)
|
||||||
|
users5 = users5[:25]
|
||||||
|
|
||||||
|
if request.host == 'pcmemes.net':
|
||||||
|
users6 = users.order_by(User.basedcount.desc()).all()
|
||||||
|
pos6 = users6.index(v)
|
||||||
|
users6 = users6[:25]
|
||||||
|
else:
|
||||||
|
users6 = None
|
||||||
|
pos6 = None
|
||||||
|
|
||||||
|
users7 = users.order_by(User.coins_spent.desc()).all()
|
||||||
|
pos7 = users7.index(v)
|
||||||
|
users7 = users7[:25]
|
||||||
|
|
||||||
|
users10 = db.query(User).order_by(User.truecoins.desc()).all()
|
||||||
|
pos10 = users10.index(v)
|
||||||
|
users10 = users10[:25]
|
||||||
|
|
||||||
return render_template("leaderboard.html", v=v, users1=users1, pos1=pos1, users2=users2, pos2=pos2, users3=users3, pos3=pos3, users4=users4, pos4=pos4, users5=users5, pos5=pos5, users6=users6, pos6=pos6, users7=users7, pos7=pos7, users9=users9, users10=users10, pos10=pos10, users12=users12, users13=users13, users15=users15)
|
return render_template("leaderboard.html", v=v, users1=users1, pos1=pos1, users2=users2, pos2=pos2, users3=users3, pos3=pos3, users4=users4, pos4=pos4, users5=users5, pos5=pos5, users6=users6, pos6=pos6, users7=users7, pos7=pos7, users9=users9, users10=users10, pos10=pos10, users12=users12, users13=users13, users15=users15)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue