Badge based on link stats?

If the badge is bronze, nobody’s ever going to receive a notification for that; the granted_at will be too old. You’re going to have to use row_number() to get the correct date for the badge.