New User of the Month badge awarded before registraton date

Hello all!

I’ve just noticed that two of my users got the New user of the month badge before their actual registration date. That shouldn’t be possible should it?


I currently have two members that have been granted this badge before registration date.

4 Likes

I think there’s a problem with the logic that’s being used here:

https://github.com/discourse/discourse/blob/master/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb#L13-L25

It’s checking stats for any users who were created after the beginning of the previous month. So if a user joined in mid June, it will be checking stats from the beginning of May up until mid June. The badge is then has its created_at date set to the end of the previous month (May 31). This would allow a user who was created in June to have their New User of the Month badge awarded at the end of May.

10 Likes

Nice repro @simon!

This fixes it:

https://github.com/discourse/discourse/commit/a73da42691734d8afddb4a255969c934da6d4ad9

8 Likes