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)
|
||||
|
||||
for badge in badges_earned:
|
||||
try: badge_grant(user, badge)
|
||||
except: continue
|
||||
badge_grant(user, badge)
|
||||
|
|
|
@ -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):
|
||||
assert user != None
|
||||
|
||||
if check_if_exists and user.has_badge(badge_id):
|
||||
return
|
||||
if check_if_exists:
|
||||
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:
|
||||
abort(400, "Custom description is too long, max 256 characters!")
|
||||
|
|
Loading…
Reference in New Issue