# 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:** [24 Luglio 2014, 8:58am 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:** 28

<div class="post-metadata">

**Author:** ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)\
**Post date:** [8 Febbraio 2022, 10:48pm UTC](https://meta.discourse.org/t/what-is-the-bug-reporter-badge/17987/28 "2022-02-08T22:48:01Z")

</div>

@sam dove dovrei eseguire questo codice per far assegnare questo badge, e dovremmo creare una categoria per il bug report?

```plaintext
SELECT p.user_id, MIN(p.created_at) granted_at
  FROM posts p
  JOIN topics t ON t.id = p.topic_id
 WHERE t.category_id = (SELECT id FROM categories WHERE name ILIKE 'bug')
   AND p.post_number = 1
   AND EXISTS (
         SELECT 1
           FROM post_actions pa
          WHERE pa.post_id = p.id 
            AND pa.post_action_type_id = (SELECT id FROM post_action_types WHERE name_key = 'like') 
            AND pa.user_id IN (SELECT user_id FROM group_users WHERE group_id = (SELECT id FROM groups WHERE name ILIKE 'team'))
       )
 GROUP BY p.user_id
HAVING COUNT(*) >= 20

```

---

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