Skip to content

Commit

Permalink
Merge pull request #82 from notmarkmiranda/80-order-of-players-in-dro…
Browse files Browse the repository at this point in the history
…pdown

[80] Refactor game#available_users to sort by full_name
  • Loading branch information
notmarkmiranda committed Feb 12, 2019
2 parents 37de1d4 + dc26c45 commit 8bb7346
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/game.rb
Expand Up @@ -9,7 +9,7 @@ class Game < ApplicationRecord

def available_players
all_users = User.joins(:memberships).where('memberships.league_id = ?', league.id)
available_users = all_users - players.map(&:user)
available_users = (all_users - players.map(&:user)).sort_by(&:full_name)
available_users.collect { |user| [user.full_name, user.id] }
end

Expand Down

0 comments on commit 8bb7346

Please sign in to comment.