# How to see that a Topic has earned a badge

**URL:** <https://meta.discourse.org/t/how-to-see-that-a-topic-has-earned-a-badge/30958>\
**Category:** Feature\
**Created:** [Juillet 10, 2015, 8:27 UTC](https://meta.discourse.org/t/how-to-see-that-a-topic-has-earned-a-badge/30958 "2015-07-10T20:27:58Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [Juillet 10, 2015, 8:27 UTC](https://meta.discourse.org/t/how-to-see-that-a-topic-has-earned-a-badge/30958/1 "2015-07-10T20:27:59Z")

</div>

I am using Discourse to run online courses ([https://literatecomputing.com/](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.

```sql
    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:

[nice topic from meta](http://try.discourse.org/badges/18/nice-topic) that links to [this post](http://try.discourse.org/t/whoa-check-out-this-crazy-paper-artwork/77). You can see that there’s a “nice topic”, but when you see the topic itself, there’s no indication. Is there some way to see that?

---

_[View the full topic](https://meta.discourse.org/t/how-to-see-that-a-topic-has-earned-a-badge/30958)._
