post bet distributions

master
justcool393 2022-10-05 22:59:27 -07:00
parent 6401f9e9c2
commit 6911101e29
3 changed files with 3 additions and 2 deletions

View File

@ -377,7 +377,7 @@ class Submission(Base):
if o.exclusive == 3: if o.exclusive == 3:
body += " - <b>WINNER!</b>" body += " - <b>WINNER!</b>"
if not winner and v and v.admin_level > 2: if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']:
body += f'''<button class="btn btn-primary distribute" onclick="this.nextElementSibling.classList.remove('d-none');this.classList.add('d-none')">Declare winner</button><button class="btn btn-primary distribute d-none" onclick="post_toast(this,'/distribute/{o.id}',true)">Are you sure?</button>''' body += f'''<button class="btn btn-primary distribute" onclick="this.nextElementSibling.classList.remove('d-none');this.classList.add('d-none')">Declare winner</button><button class="btn btn-primary distribute d-none" onclick="post_toast(this,'/distribute/{o.id}',true)">Are you sure?</button>'''
body += "</div>" body += "</div>"
else: else:

View File

@ -141,6 +141,7 @@ PERMS = { # Minimum admin_level to perform action.
'POST_TO_CHANGELOG': 1, 'POST_TO_CHANGELOG': 1,
'POST_TO_POLL_THREAD': 2, 'POST_TO_POLL_THREAD': 2,
'POST_BETS': 3, 'POST_BETS': 3,
'POST_BETS_DISTRIBUTE': 3, # probably should be the same as POST_BETS but w/e
'BYPASS_PIN_LIMIT': 3, 'BYPASS_PIN_LIMIT': 3,
'VIEW_PENDING_SUBMITTED_MARSEYS': 3, 'VIEW_PENDING_SUBMITTED_MARSEYS': 3,
'VIEW_PENDING_SUBMITTED_HATS': 3, 'VIEW_PENDING_SUBMITTED_HATS': 3,

View File

@ -193,7 +193,7 @@ def remove_admin(v, username):
@app.post("/distribute/<option_id>") @app.post("/distribute/<option_id>")
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(3) @admin_level_required(PERMS['POST_BETS_DISTRIBUTE'])
def distribute(v, option_id): def distribute(v, option_id):
autojanny = get_account(AUTOJANNY_ID) autojanny = get_account(AUTOJANNY_ID)
if autojanny.coins == 0: return {"error": "@AutoJanny has 0 coins"}, 400 if autojanny.coins == 0: return {"error": "@AutoJanny has 0 coins"}, 400