actually fix roulette (i forgot that i had @lazy before def has_badge)
parent
0c2e0f0b67
commit
c123654f6d
|
@ -106,5 +106,4 @@ def distribute_wager_badges(user, wager, won):
|
||||||
badges_earned.add(159)
|
badges_earned.add(159)
|
||||||
|
|
||||||
for badge in badges_earned:
|
for badge in badges_earned:
|
||||||
try: badge_grant(user, badge)
|
badge_grant(user, badge)
|
||||||
except: continue
|
|
||||||
|
|
|
@ -6,8 +6,9 @@ from files.helpers.alerts import send_repeatable_notification
|
||||||
def badge_grant(user, badge_id, description=None, url=None, notify=True, check_if_exists=True):
|
def badge_grant(user, badge_id, description=None, url=None, notify=True, check_if_exists=True):
|
||||||
assert user != None
|
assert user != None
|
||||||
|
|
||||||
if check_if_exists and user.has_badge(badge_id):
|
if check_if_exists:
|
||||||
return
|
existing = g.db.query(Badge).filter_by(user_id=user.id, badge_id=badge_id).one_or_none()
|
||||||
|
if existing: return
|
||||||
|
|
||||||
if description and len(description) > 256:
|
if description and len(description) > 256:
|
||||||
abort(400, "Custom description is too long, max 256 characters!")
|
abort(400, "Custom description is too long, max 256 characters!")
|
||||||
|
|
Loading…
Reference in New Issue