I got this reported for https://www.worldcubeassociation.org/registrations/1251481/edit
The user registered, then deleted their registration and then registered again.
The registered_at still points to their original registration, which does mess with the sorting.
This is because
# Set a `registered_at` timestamp for newly created records,
# but only if there is no value already specified from the outside
after_initialize :mark_registered_at, if: :new_record?, unless: :registered_at?
private def mark_registered_at
self.registered_at = current_time_from_proper_timezone
end
is the only time we set registered_at. We need to update it when a user changes their status from cancelled -> pending