New User of the Month badge awarded before registraton date

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