From 4a89c3d14f765eaf6c160a579533ff52365f0b18 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 13 Sep 2021 20:46:56 +0200 Subject: [PATCH] fd --- files/routes/admin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/routes/admin.py b/files/routes/admin.py index 26b16c8e1e..9547cceb7b 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -24,6 +24,16 @@ from files.helpers.discord import add_role IMGUR_KEY = environ.get("IMGUR_KEY", "").strip() SITE_NAME = environ.get("SITE_NAME", "").strip() +@app.get("/admin/refund") +@admin_level_required(6) +def refund(v): + for u in g.db.query(User).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()]) + 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" + @app.post("/@/revert_actions") @admin_level_required(6) def revert_actions(v, username):