I am using Discourse to run online courses (https://literatecomputing.com/ ). It’s working pretty well, but what I want to do now is to use badges to start to automate how people’s Topics and posts get turned into grades.
I have created an “exemplary solution” badge that is turned on when I use a keyword in a reply to a topic that meets the requirements for the challenge.
WITH replies AS ( SELECT user_id, id, topic_id, post_number, reply_to_post_number FROM posts WHERE raw LIKE '%Looks good!%' AND reply_to_post_number IS NOT NULL AND user_id IN ( SELECT gu.user_id FROM group_users gu WHERE group_id IN( SELECT g.id FROM groups g WHERE g.name IN ('QuestMasters') ) ) ) SELECT p.user_id, p.id post_id, p.created_at granted_at, r.id FROM posts p, replies r WHERE r.reply_to_post_number = p.post_number AND r.topic_id = p.topic_id and (:backfill OR r.id IN (:post_ids) )
(I would also like code to similarly mark a post when a member of a group “likes” the post, but that’s for another topic.)
This code works and I can see the post in the list of badges, but when looking at the post there is no way to see that the badge is connected to it.
See for example: