From 0fdaccdbbc937129244fca4188a692b0e34cf0df Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 11 Dec 2021 05:32:43 +0200 Subject: [PATCH] sfdfsd --- files/classes/submission.py | 1 + files/helpers/const.py | 2 +- files/routes/admin.py | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 01da808cc..fb898fae7 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -96,6 +96,7 @@ class Submission(Base): return False def total_bet_voted(self, v): + if "closed" in self.body.lower(): return True if v: for option in self.bet_options: if option.poll_voted(v): return True diff --git a/files/helpers/const.py b/files/helpers/const.py index 7a3e89b63..bd0ca7ca6 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -182,7 +182,7 @@ else: LONGPOSTBOT_ID = 4 ZOZBOT_ID = 5 AUTOPOLLER_ID = 6 - AUTOBETTER_ID = 7 + AUTOBETTER_ID = 10 TAX_RECEIVER_ID = 8 PIZZA_SHILL_ID = 0 IDIO_ID = 0 diff --git a/files/routes/admin.py b/files/routes/admin.py index 7b109122c..229c7e17c 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -22,16 +22,18 @@ if SITE_NAME == 'PCM': cc = "splash mountain" else: cc = "country club" @app.get("/distribute/") -@admin_level_required(2) +@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.permalink votes = g.db.query(CommentVote).filter_by(comment_id=cid) autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first() coinsperperson = int(autobetter.coins / votes.count()) for vote in votes: u = vote.user u.coins += coinsperperson + send_notification(u.id, f"You won {coinsperperson} coins betting on https://{request.host}{post} !") g.db.add(u) autobetter.coins = 0