master
Aevann1 2021-12-23 20:28:20 +02:00
parent cb7e1a5518
commit b03a9a1a54
1 changed files with 6 additions and 1 deletions

View File

@ -44,7 +44,7 @@ def distribute(v, cid):
votes = g.db.query(CommentVote).filter_by(comment_id=cid) votes = g.db.query(CommentVote).filter_by(comment_id=cid)
coinsperperson = int(pool / votes.count()) coinsperperson = int(pool / votes.count())
cid = notif_comment(f"You won {coinsperperson} coins betting on [{post.permalink}]({post.permalink}) !") cid = notif_comment(f"You won {coinsperperson} coins betting on [{post.permalink}]({post.permalink}) :marseyparty:")
for vote in votes: for vote in votes:
u = vote.user u = vote.user
u.coins += coinsperperson u.coins += coinsperperson
@ -54,6 +54,11 @@ def distribute(v, cid):
autobetter.coins -= pool autobetter.coins -= pool
g.db.add(autobetter) g.db.add(autobetter)
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)
votes = g.db.query(CommentVote).filter(CommentVote.comment_id.in_(cids)).all()
for vote in votes: dd_notif(cid, vote.user.id)
g.db.commit() g.db.commit()
return f"Each winner has received {coinsperperson} coins!" return f"Each winner has received {coinsperperson} coins!"