Refactor team ranking view.

* Move ordering logic to Team model (Team.ranking)
* Use sort_by with Array (see Array#<=> in Ruby's reference)