From 8859a691e457500c93cf9a1fa0becfa11bfd23c3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Dec 2021 20:43:52 +0200 Subject: [PATCH] sdfdsf --- files/routes/admin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index e6b1b8f2f..0202cf25e 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -32,19 +32,19 @@ def grassed(v): else: template = 'CHRISTMAS/' return render_template(f"{template}grassed.html", v=v, users=users) -@app.get("/distribute/") +@app.get("/distribute/") @limiter.limit("1/second") @admin_level_required(3) def distribute(v, cid): try: int(cid) except: abort(400) - post = g.db.query(Comment).filter_by(id=cid).first().post + post = g.db.query(Comment).filter_by(id=comment).first().post pool = 0 for option in post.bet_options: pool += option.upvotes pool *= 200 - votes = g.db.query(CommentVote).filter_by(comment_id=cid) + votes = g.db.query(CommentVote).filter_by(comment_id=comment) coinsperperson = int(pool / votes.count()) cid = notif_comment(f"You won {coinsperperson} coins betting on [{post.permalink}]({post.permalink}) :marseyparty:") @@ -59,7 +59,7 @@ def distribute(v, cid): cid = notif_comment(f"You lost the 200 coins you bet on [{post.permalink}]({post.permalink}) :marseylaugh:") cids = [x.id for x in post.bet_options] - cids.remove(cid) + cids.remove(comment) votes = g.db.query(CommentVote).filter(CommentVote.comment_id.in_(cids)).all() for vote in votes: add_notif(cid, vote.user.id)