use constant instead of literal 200 for poll bets
parent
b1930a1cd7
commit
4037eed228
|
@ -366,12 +366,12 @@ class Submission(Base):
|
|||
if o.exclusive > 1:
|
||||
body += f'''<div class="custom-control mt-2"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" onchange="bet_vote('{o.id}','{self.id}')"'''
|
||||
if o.voted(v): body += " checked "
|
||||
if not (v and v.coins >= 200) or self.total_bet_voted(v): body += " disabled "
|
||||
if not (v and v.coins >= POLL_BET_COINS) or self.total_bet_voted(v): body += " disabled "
|
||||
|
||||
body += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
|
||||
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="option-{o.id}">{o.upvotes}</span> bets</a>'
|
||||
if not self.total_bet_voted(v):
|
||||
body += '''<span class="cost"> (cost of entry: 200 coins)</span>'''
|
||||
body += f'''<span class="cost"> (cost of entry: {POLL_BET_COINS} coins)</span>'''
|
||||
body += "</label>"
|
||||
|
||||
if o.exclusive == 3:
|
||||
|
|
|
@ -193,6 +193,7 @@ DONGER_ID = 0
|
|||
GEESE_ID = 0
|
||||
|
||||
POLL_THREAD = 0
|
||||
POLL_BET_COINS = 200
|
||||
WELCOME_MSG = f"Welcome to {SITE_NAME}!"
|
||||
ROLES={}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ def distribute(v, option_id):
|
|||
pool = 0
|
||||
for o in post.options:
|
||||
if o.exclusive >= 2: pool += o.upvotes
|
||||
pool *= 200
|
||||
pool *= POLL_BET_COINS
|
||||
|
||||
autojanny.coins -= pool
|
||||
if autojanny.coins < 0: autojanny.coins = 0
|
||||
|
@ -229,7 +229,7 @@ def distribute(v, option_id):
|
|||
add_notif(cid, u.id)
|
||||
|
||||
|
||||
cid = notif_comment(f"You lost the 200 coins you bet on [{post.title}]({post.shortlink}) :marseylaugh:")
|
||||
cid = notif_comment(f"You lost the {POLL_BET_COINS} coins you bet on [{post.title}]({post.shortlink}) :marseylaugh:")
|
||||
losing_voters = []
|
||||
for o in post.options:
|
||||
if o.exclusive == 2:
|
||||
|
|
|
@ -22,11 +22,11 @@ def vote_option(option_id, v):
|
|||
return {"error": f"You need to be a member of House {sub.capitalize()} to vote on polls in /h/{sub}"}, 400
|
||||
|
||||
if option.exclusive == 2:
|
||||
if v.coins < 200: return {"error": "You don't have 200 coins!"}, 400
|
||||
v.coins -= 200
|
||||
if v.coins < POLL_BET_COINS: return {"error": f"You don't have {POLL_BET_COINS} coins!"}, 400
|
||||
v.coins -= POLL_BET_COINS
|
||||
g.db.add(v)
|
||||
autojanny = get_account(AUTOJANNY_ID)
|
||||
autojanny.coins += 200
|
||||
autojanny.coins += POLL_BET_COINS
|
||||
g.db.add(autojanny)
|
||||
|
||||
if option.exclusive:
|
||||
|
|
Loading…
Reference in New Issue