diff --git a/files/helpers/useractions.py b/files/helpers/useractions.py index 3eef49ad55..cd09b5e866 100644 --- a/files/helpers/useractions.py +++ b/files/helpers/useractions.py @@ -4,6 +4,7 @@ from files.classes.badges import Badge from files.helpers.alerts import send_repeatable_notification def badge_grant(user, badge_id, notify=True, check_if_exists=True): + g.db.flush() existing = g.db.query(Badge).filter_by(user_id=user.id, badge_id=badge_id).one_or_none() if existing: return