SQL Querying in Badges

Hi guys,

So I’m extremely new to Discourse and I think I’ve just successfully written my first badge that assigns a badge to a user if they have received 5-9 likes. It is as follows:

SELECT user_id, users.username username, likes_received, current_timestamp granted_at
FROM user_stats JOIN users ON (user_stats.user_id = users.id)
WHERE likes_received BETWEEN 5 AND 9
AND (:backfill OR users.id IN (:user_ids) )

When I click ‘preview granted badges’, it shows the 8 users that have fulfilled this requirement. Does this mean that when the update occurs, this badge will be assigned automatically?

Thanks!

1 Like

Yes, as soon as the daily grant runs they will get badges

2 Likes