After #4394 is merged, some of the code there should be improved. In particular, instead of using raw SQL for the queries, we should try to use ActiveRecord. At the moment, there are 4 different queries:
competitionId. Maybe this could be resolved by adding the competitionId to the tables? Or maybe we should just get the result.I don't think we can use RanksSingle for "N persons of some country/continent" because some competitors have changed their countries. They should show on "N persons" for their previous countries but their rankings are based on the current countries.
Another point: we could set up caching for rankings. The PHP cache is cleared as a part of CAD, so in Rails we could use CAD timestamp in cache key.
Maybe I didn't catch this somewhere, but it seems the "All" option is gone for rankings and you can only get 100/1000. This was intentional? (For both Person and Result.)

The "All persons" option was not working anymore with the old PHP code, so I just got rid of it. Adding pagination as @jonatanklosko suggested here is an option to have it back! (And there wasn't an "All results" option.)
As a quick workaround: the number on the URL can be modified to show any arbitrary number of persons/results.