polls: don't allow bets on closed polls

pull/2/head
justcool393 2022-11-20 10:11:24 -06:00
parent 23ff5450d6
commit a2c4bca2da
1 changed files with 2 additions and 0 deletions

View File

@ -20,6 +20,8 @@ def vote_option(option_id, v):
abort(403, f"You need to be a member of House {sub.capitalize()} to vote on polls in /h/{sub}")
if option.exclusive == 2:
if option.post.total_bet_voted:
abort(403, "You can't bet on a closed poll!")
if not v.charge_account('coins', POLL_BET_COINS):
abort(400, f"You don't have {POLL_BET_COINS} coins!")
g.db.add(v)