Why didn't I receive the Gives back badge?


(Stefano Costa) #1

First off, let’s clarify that I’m using myself as an example just to make sure the issue I’m seeing is not a bug somewhere in the badge machinery :slight_smile:

The Gives back :heart: badge

is granted when you’ve received 100 likes and have given 100 or more likes in return.

Cool! So I gave 464 likes and received 128, I should totally have this badge, but no, I don’t. I see users with similar numbers in likes received/given than me who have it, so what happened? Is a certain ratio needed as with other badges?


(Mittineague) #2

Possibly.

More likely due due another reason.

Has the job ran since passing the threshold?

Were all of the Likes in Categories that granted badges? i.e. the setting
"Allow badges to be awarded in this category"
* note, messages don’t have a category

If you prefer code the query is

SELECT us.user_id, current_timestamp AS granted_at
FROM user_stats AS us
INNER JOIN posts AS p ON p.user_id = us.user_id
WHERE p.like_count > 0
  AND us.likes_given >= 100
  AND (:backfill OR us.user_id IN (:user_ids))
GROUP BY us.user_id, us.likes_given
HAVING COUNT(*) > 100

And the setting is

Trigger
Update daily


(Jeff Atwood) #3

Perhaps @eviltrout can take a quick look on Monday.


(Robin Ward) #4

The query is based on the number of posts that have received a like, not the total number of likes received. You’ve only had 57 posts that have received a like.

The short description of “Has 100 liked posts and gave 100 likes” seems more accurate than the long description.


(Stefano Costa) #5

Oh, that makes sense, thanks! It’s the description that needs to be fixed then :slight_smile:


(Jeff Atwood) #6

Good point! I just fixed the long descriptions for these. Sorry about the confusion, my bad!


(Jeff Atwood) #7