# What is the bug reporter badge?

**URL:** <https://meta.discourse.org/t/what-is-the-bug-reporter-badge/17987>\
**Category:** Data & reporting\
**Tags:** sql-triggered-badge\
**Created:** [2014年七月24日 08:58 UTC](https://meta.discourse.org/t/what-is-the-bug-reporter-badge/17987 "2014-07-24T08:58:01Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)\
**Post date:** [2015年八月12日 10:26 UTC](https://meta.discourse.org/t/what-is-the-bug-reporter-badge/17987/13 "2015-08-12T10:26:15Z")

</div>

I tried to build my own version:

```plaintext
SELECT p.user_id, min(p.created_at) granted_at, MIN(p.id) post_id
FROM badge_posts p
JOIN topics t ON t.id = p.topic_id
WHERE category_id = (
        SELECT id FROM categories WHERE name ilike '<CATEGORY_NAME>'
    ) AND (
        SELECT count(*)
        FROM post_actions pa
        WHERE pa.post_id = p.id
            AND post_action_type_id = (
                SELECT id FROM post_action_types WHERE name_key = 'like'
            ) AND pa.user_id IN (
                SELECT gu.user_id
                FROM group_users gu
                WHERE gu.group_id = ( SELECT id FROM groups WHERE name ilike '<TEAM_NAME>' ) 
            )
    ) >= <LIKE_COUNT>
    AND p.post_number = 1
    AND p.user_id >= 0
GROUP BY p.user_id
HAVING count(*) >= <POST_COUNT>

```

Does anyone see any issue with that?

---

_[View the full topic](https://meta.discourse.org/t/what-is-the-bug-reporter-badge/17987)._
