"Promoter" Badge broken?


#1

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.


What is SQL Badge Query for invited >25 People?
Copy-Paste Locked Badge Query (SQL) For More Than Champion or Invitation
(Jeff Atwood) #2

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


(Sam Saffron) #3

Looks like a bug, will update the badge.


(Sam Saffron) #4

fixed in:

https://github.com/discourse/discourse/commit/5b16adc0e83446542bf9e8656e0a8b4deeff5dc9


(Sam Saffron) #5