# "Promoter" Badge broken?

**URL:** https://meta.discourse.org/t/promoter-badge-broken/34413
**Category:** Bug
**Created:** [2015年十月12日 16:23 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413 "2015-10-12T16:23:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![uppfinnarn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uppfinnarn/32/121981_2.png) [@uppfinnarn](https://meta.discourse.org/u/uppfinnarn)
#### Post date: [2015年十月12日 16:23 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413/1 "2015-10-12T16:23:24Z")

</div>

It looks like the “Promoter” badge isn’t getting assigned properly, at least on our forum.

The SQL for it is:

```
SELECT u.id user_id, current_timestamp granted_at
FROM users u
WHERE u.id IN (
  SELECT invited_by_id
  FROM invites i
  JOIN users u2 ON u2.id = i.user_id
  WHERE i.deleted_at IS NULL AND u2.active AND u2.trust_level >= 0 AND not u2.blocked
  GROUP BY invited_by_id
  HAVING COUNT(*) > 1
) AND u.active AND NOT u.blocked AND u.id > 0 AND
  (:backfill OR u.id IN (:user_ids) )

```

The problem appears to be the `HAVING COUNT(*) > 1`… shouldn’t that be `HAVING COUNT(*) >= 1`? Requiring someone to have invited more than one person to get the Promoter badge seems strange.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2015年十月12日 22:13 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413/2 "2015-10-12T22:13:29Z")

</div>

It is @sam’s badge so he should respond.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015年十月12日 22:38 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413/3 "2015-10-12T22:38:13Z")

</div>

Looks like a bug, will update the badge.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015年十月13日 01:32 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413/4 "2015-10-13T01:32:50Z")

</div>

fixed in:

[https://github.com/discourse/discourse/commit/5b16adc0e83446542bf9e8656e0a8b4deeff5dc9](https://github.com/discourse/discourse/commit/5b16adc0e83446542bf9e8656e0a8b4deeff5dc9)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015年十月13日 01:32 UTC](https://meta.discourse.org/t/promoter-badge-broken/34413/5 "2015-10-13T01:32:53Z")

</div>


