I have a badge that’s awarded to people who attend one of our regular events. Because it’s not straightforward to grant badges en masse, I’m using custom SQL to grant the badge. What’s not working, though, is receiving the badge multiple times. I’ve tried to make this work by having one group per event, and including the group’s creation date as the
SELECT user_id, created_at granted_at, NULL post_id FROM group_users WHERE group_id IN ( SELECT g.id FROM groups g WHERE g.name IN ( 'vit-2016-s2', 'vit-2017-s1', 'vit-2017-s2' ) ) AND ( :backfill OR user_id IN (:user_ids) )
Even though I’m a member of all three of these groups, and in Data Explorer I see three results for my user, there’s still only one instance of the badge that’s granted.
How would I go about changing this so that the badge will automatically be awarded to each user for each group they’re a member of?