Badge SQL triggered on post content

AI-generated summary

Alexander_Wright reports an issue where a SQL-triggered badge fails to award users despite the query preview showing matches. The badge is configured to trigger when a post contains the text ‘Give Me A Badge’, using a query on badge_posts with the condition that a user creates or edits a post. zogstrip states they cannot reproduce the issue but identifies potential bugs in the BadgeGranter component, linking to a GitHub pull request (#37674) that may resolve the problem. After Alexander_Wright confirms the issue persists, zogstrip requests more detailed information about the user’s setup to attempt further reproduction.

I’m trying to award a badge depending on the content of a post.

For example, If I type ‘Give Me A Badge’ i’m awarded the ‘Demanding’ badge.

My SQL is as follows:

SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.raw LIKE '%Give Me A Badge%' 
AND (:backfill OR p.id IN (:post_ids) )

With ‘Query targets posts’ and ‘When a user creates or edits a post’.

It’s not, however being triggered. The ’ Badge Query Preview’ shows hits for awards, but the site doesn’t appear to be awarding them.

Help and advice welcome, please.

I’m unfortunately not able to reproduce :thinking:

That said, I found a couple bugs in BadgeGranter that could prevent badges from being granted.

Maybe once it’s merged, you could upgrade and try again?

I’ve just checked, still no joy, sadly.

any chances you could give more information about your setup and/or what you’re doing so that i can hopefully try to reproduce? :face_with_monocle: