Grant a badge for all members of a group

AI-generated summary

sam explains how to create a badge for all members of a specific group using a SQL query in the Data & reporting section. To target a group, users can input a query selecting user_id and created_at from group_users, filtering by the group’s ID derived from its lowercase name. While a SQL trigger for faster granting is planned, sam suggests manually rushing the process by kicking off the badge job via /sidekiq/scheduler in the interim. For further details on custom badge SQL queries, the post references the guide on Triggered custom badge queries.

I just created a badge for all the awesome plugin authors.

Creating a badge targeting a group is quite easy, just type this into the SQL box:

select user_id, created_at granted_at, NULL post_id
from group_users
where group_id = (
  select g.id from groups g where g.name = 'GROUP_NAME_IN_LOWER_HERE'
)

I will add a trigger for this at some point so granting is faster, in the mean time just go to /sidekiq/scheduler and kick off the badge job to rush it.

See Triggered custom badge queries for more information about custom badge SQL queries.


Last Reviewed by @SaraDev on 2022-05-25T00:30:00Z

29 curtidas