diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-28 00:04:47 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-28 00:04:47 -0400 |
commit | 6b66877bda4c0e4a33bb3109304636d5ada85904 (patch) | |
tree | 7065307802fec8452afc89c8a7b445fd2ceca772 /lib/seeding/fair_ranked_seeding.rb | |
parent | 33fcf6de9feaaa6f90dfe5082e08d280c930dae1 (diff) | |
parent | 7a4832621f1a0bb2e4b86ee9f879a73df0188a3e (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'lib/seeding/fair_ranked_seeding.rb')
-rw-r--r-- | lib/seeding/fair_ranked_seeding.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/seeding/fair_ranked_seeding.rb b/lib/seeding/fair_ranked_seeding.rb index f56d648..870ebdd 100644 --- a/lib/seeding/fair_ranked_seeding.rb +++ b/lib/seeding/fair_ranked_seeding.rb @@ -5,6 +5,9 @@ module Seeding match = matches.first match_num = 0 players_used = 0 + (tournament.players.count/tournament.min_players_per_team).floor.times do + match.teams.push Team.create() + end best_first(tournament).each_slice(tournament.min_teams_per_match) do |slice| (0..tournament.min_teams_per_match-1).each do |index| match.teams[index].players += slice[index] @@ -30,7 +33,7 @@ module Seeding end def self.previous_score(player, tournament) - score = tournament.statistics.getStatistic(player.matches.last, player, :score) + score = tournament.statistics.where(match: player.matches.last, user: player, name: :score) if score.nil? return 0 end |