show a list of blockers
parent
0f232b264c
commit
e793a1ab3a
|
@ -639,7 +639,7 @@ def users_list(v):
|
|||
next_exists = (len(users) > 25)
|
||||
users = users[:25]
|
||||
|
||||
return render_template("admin/new_users.html",
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
|
@ -647,28 +647,6 @@ def users_list(v):
|
|||
)
|
||||
|
||||
|
||||
@app.get("/badge_owners/<bid>")
|
||||
@auth_required
|
||||
def bid_list(v, bid):
|
||||
|
||||
try: bid = int(bid)
|
||||
except: abort(400)
|
||||
|
||||
try: page = int(request.values.get("page", 1))
|
||||
except: page = 1
|
||||
|
||||
users = g.db.query(User).join(User.badges).filter(Badge.badge_id==bid).offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
next_exists = (len(users) > 25)
|
||||
users = users[:25]
|
||||
|
||||
return render_template("admin/new_users.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
page=page,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/admin/alt_votes")
|
||||
@admin_level_required(2)
|
||||
|
|
|
@ -125,7 +125,7 @@ def hat_owners(v, hat_id):
|
|||
next_exists = (len(users) > 25)
|
||||
users = users[:25]
|
||||
|
||||
return render_template("admin/new_users.html",
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
|
|
|
@ -68,8 +68,7 @@ def sidebar(v):
|
|||
@app.get("/stats")
|
||||
@auth_required
|
||||
def participation_stats(v):
|
||||
return render_template("admin/content_stats.html",
|
||||
v=v, title="Content Statistics", data=stats_cached())
|
||||
return render_template("stats.html", v=v, title="Content Statistics", data=stats_cached())
|
||||
|
||||
@cache.memoize(timeout=86400)
|
||||
def stats_cached():
|
||||
|
|
|
@ -19,11 +19,10 @@ from sys import stdout
|
|||
import os
|
||||
|
||||
|
||||
def leaderboard_thread():
|
||||
global users9, users9_1, users9_2, users13, users13_1, users13_2
|
||||
|
||||
def leaderboard_thread():
|
||||
db = db_session()
|
||||
|
||||
global users9, users9_1, users9_2
|
||||
votes1 = db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote).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).filter(CommentVote.vote_type==-1).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
votes3 = Counter(dict(votes1)) + Counter(dict(votes2))
|
||||
|
@ -32,12 +31,9 @@ def leaderboard_thread():
|
|||
for user in users8:
|
||||
users9.append((user.id, votes3[user.id]))
|
||||
users9 = sorted(users9, key=lambda x: x[1], reverse=True)
|
||||
|
||||
if (len(users9) < 2):
|
||||
return
|
||||
|
||||
users9_1, users9_2 = zip(*users9[:25])
|
||||
|
||||
global users13, users13_1, users13_2
|
||||
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))
|
||||
|
@ -51,18 +47,13 @@ def leaderboard_thread():
|
|||
db.close()
|
||||
stdout.flush()
|
||||
|
||||
|
||||
gevent.spawn(leaderboard_thread())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@app.get("/@<username>/upvoters/<uid>/posts")
|
||||
@auth_required
|
||||
def upvoters_posts(v, username, uid):
|
||||
|
@ -1352,3 +1343,49 @@ def toggle_pins(sort):
|
|||
if is_site_url(request.referrer):
|
||||
return redirect(request.referrer)
|
||||
return redirect('/')
|
||||
|
||||
|
||||
@app.get("/badge_owners/<bid>")
|
||||
@auth_required
|
||||
def bid_list(v, bid):
|
||||
|
||||
try: bid = int(bid)
|
||||
except: abort(400)
|
||||
|
||||
try: page = int(request.values.get("page", 1))
|
||||
except: page = 1
|
||||
|
||||
users = g.db.query(User).join(User.badges).filter(Badge.badge_id==bid).offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
next_exists = (len(users) > 25)
|
||||
users = users[:25]
|
||||
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
page=page,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/blockers/<uid>")
|
||||
@auth_required
|
||||
def blockers_list(v, uid):
|
||||
|
||||
try: uid = int(uid)
|
||||
except: abort(400)
|
||||
|
||||
try: page = int(request.values.get("page", 1))
|
||||
except: page = 1
|
||||
|
||||
users = g.db.query(User).join(User.blocking).filter(UserBlock.target_id==uid).offset(25 * (page - 1)).limit(26).all()
|
||||
|
||||
next_exists = (len(users) > 25)
|
||||
users = users[:25]
|
||||
|
||||
return render_template("user_cards.html",
|
||||
v=v,
|
||||
users=users,
|
||||
next_exists=next_exists,
|
||||
page=page,
|
||||
)
|
|
@ -480,7 +480,7 @@
|
|||
<tr {% if v.id == user.target_id %}class="self"{% endif %}>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td>{{num}}</td>
|
||||
<td><a href="/blockers/{{user.id}}">{{num}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue