sfdfsd
This commit is contained in:
parent
2a965e9ff5
commit
fcf07bf036
3 changed files with 5 additions and 2 deletions
|
@ -96,6 +96,7 @@ class Submission(Base):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def total_bet_voted(self, v):
|
def total_bet_voted(self, v):
|
||||||
|
if "closed" in self.body.lower(): return True
|
||||||
if v:
|
if v:
|
||||||
for option in self.bet_options:
|
for option in self.bet_options:
|
||||||
if option.poll_voted(v): return True
|
if option.poll_voted(v): return True
|
||||||
|
|
|
@ -182,7 +182,7 @@ else:
|
||||||
LONGPOSTBOT_ID = 4
|
LONGPOSTBOT_ID = 4
|
||||||
ZOZBOT_ID = 5
|
ZOZBOT_ID = 5
|
||||||
AUTOPOLLER_ID = 6
|
AUTOPOLLER_ID = 6
|
||||||
AUTOBETTER_ID = 7
|
AUTOBETTER_ID = 10
|
||||||
TAX_RECEIVER_ID = 8
|
TAX_RECEIVER_ID = 8
|
||||||
PIZZA_SHILL_ID = 0
|
PIZZA_SHILL_ID = 0
|
||||||
IDIO_ID = 0
|
IDIO_ID = 0
|
||||||
|
|
|
@ -22,16 +22,18 @@ if SITE_NAME == 'PCM': cc = "splash mountain"
|
||||||
else: cc = "country club"
|
else: cc = "country club"
|
||||||
|
|
||||||
@app.get("/distribute/<cid>")
|
@app.get("/distribute/<cid>")
|
||||||
@admin_level_required(2)
|
@admin_level_required(3)
|
||||||
def distribute(v, cid):
|
def distribute(v, cid):
|
||||||
try: int(cid)
|
try: int(cid)
|
||||||
except: abort(400)
|
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)
|
votes = g.db.query(CommentVote).filter_by(comment_id=cid)
|
||||||
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
|
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
|
||||||
coinsperperson = int(autobetter.coins / votes.count())
|
coinsperperson = int(autobetter.coins / votes.count())
|
||||||
for vote in votes:
|
for vote in votes:
|
||||||
u = vote.user
|
u = vote.user
|
||||||
u.coins += coinsperperson
|
u.coins += coinsperperson
|
||||||
|
send_notification(u.id, f"You won {coinsperperson} coins betting on https://{request.host}{post} !")
|
||||||
g.db.add(u)
|
g.db.add(u)
|
||||||
|
|
||||||
autobetter.coins = 0
|
autobetter.coins = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue