master
Aevann1 2021-09-13 20:49:20 +02:00
parent 4a89c3d14f
commit 990f2bd395
1 changed files with 7 additions and 5 deletions

View File

@ -27,11 +27,13 @@ SITE_NAME = environ.get("SITE_NAME", "").strip()
@app.get("/admin/refund") @app.get("/admin/refund")
@admin_level_required(6) @admin_level_required(6)
def refund(v): def refund(v):
for u in g.db.query(User).all(): posts=g.db.query(Submission.upvotes + Submission.downvotes - 1).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()
posts=sum([x[0]+x[1]-1 for x in g.db.query(Submission.upvotes, Submission.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()]) print(posts)
comments=sum([x[0]+x[1]-1 for x in g.db.query(Comment.upvotes, Comment.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()]) # for u in g.db.query(User).all():
u.truecoins = int(posts+comments) # posts=sum([x[0]+x[1]-1 for x in g.db.query(Submission.upvotes, Submission.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()])
g.db.add(u) # comments=sum([x[0]+x[1]-1 for x in g.db.query(Comment.upvotes, Comment.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()])
# u.truecoins = int(posts+comments)
# g.db.add(u)
return "sex" return "sex"
@app.post("/@<username>/revert_actions") @app.post("/@<username>/revert_actions")