diff options
author | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-27 23:26:24 -0400 |
---|---|---|
committer | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-27 23:26:24 -0400 |
commit | 1c37ae521e29a5e0869aba52d324ed0cd4a830a6 (patch) | |
tree | e4488ed3feb5e5dc94a72cd46cff2aeef0dcd1f8 /lib | |
parent | 6cbf08bb7659dc3265b45d05a66170f1c69ce696 (diff) | |
parent | 4c572a775a7c28b102b4462af94214148e6df1d2 (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sampling/riot_api.rb | 3 | ||||
-rw-r--r-- | lib/seeding/early_bird_seeding.rb | 2 | ||||
-rw-r--r-- | lib/seeding/fair_ranked_seeding.rb | 5 | ||||
-rw-r--r-- | lib/seeding/random_seeding.rb | 2 |
4 files changed, 8 insertions, 4 deletions
diff --git a/lib/sampling/riot_api.rb b/lib/sampling/riot_api.rb index 333095c..8c34fc4 100644 --- a/lib/sampling/riot_api.rb +++ b/lib/sampling/riot_api.rb @@ -84,7 +84,8 @@ module Sampling end ## - # TODO description + # Return whether or not the API can get a given statistic for + # a given user. public def self.can_get?(user, stat) if user.nil? diff --git a/lib/seeding/early_bird_seeding.rb b/lib/seeding/early_bird_seeding.rb index 488a1a2..5c289ed 100644 --- a/lib/seeding/early_bird_seeding.rb +++ b/lib/seeding/early_bird_seeding.rb @@ -7,7 +7,7 @@ module Seeding teams = 0 tournament.players.each_slice(tournament.min_players_per_team) do |slice| if teams < tournament.min_teams_per_match - match.teams[teams].players += slice + match.teams.push Team.create(players: slice) teams += 1 else match_num += 1 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 diff --git a/lib/seeding/random_seeding.rb b/lib/seeding/random_seeding.rb index 723d70e..36e06d6 100644 --- a/lib/seeding/random_seeding.rb +++ b/lib/seeding/random_seeding.rb @@ -7,7 +7,7 @@ module Seeding teams = 0 tournament.players.shuffle.each_slice(tournament.min_players_per_team) do |slice| if teams < tournament.min_teams_per_match - match.teams[teams].players += slice + match.teams.push Team.create(players: slice) teams += 1 else match_num += 1 |