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.


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

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.


Nice repro @simon!

This fixes it: