diff --git a/files/helpers/casino.py b/files/helpers/casino.py index a929f1d3e..5f994ec69 100644 --- a/files/helpers/casino.py +++ b/files/helpers/casino.py @@ -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) diff --git a/files/helpers/useractions.py b/files/helpers/useractions.py index 54b2c705a..d65229b76 100644 --- a/files/helpers/useractions.py +++ b/files/helpers/useractions.py @@ -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!")