From b56d72c762bf817329d0d4af4b253df284aa6640 Mon Sep 17 00:00:00 2001 From: "R.J. Osborne" Date: Mon, 18 May 2015 19:37:13 -0400 Subject: [PATCH] generatePools has a nicer arity --- app/models/pool.rb | 10 +++++----- app/models/tournamentmatchgen.rb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/pool.rb b/app/models/pool.rb index 043cba3..d21af75 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -1,10 +1,10 @@ class Pool - def generatePools(pools,wrestlers,weight,tournament,matches) - @pools = pools + def generatePools(weight, tournament, matches) + @pools = weight.pools @pool = 1 while @pool <= @pools - matches = roundRobin(@pool,wrestlers,weight,tournament,matches) - @pool = @pool + 1 + matches = roundRobin(@pool, weight.wrestlers, weight, tournament , matches) + @pool += 1 end return matches end @@ -27,4 +27,4 @@ class Pool end return matches end -end \ No newline at end of file +end diff --git a/app/models/tournamentmatchgen.rb b/app/models/tournamentmatchgen.rb index aaeb954..e518363 100644 --- a/app/models/tournamentmatchgen.rb +++ b/app/models/tournamentmatchgen.rb @@ -20,7 +20,7 @@ class Tournamentmatchgen def buildTournamentWeights(tournament_id, weight) @wrestlers = weight.wrestlers - @matches = Pool.new.generatePools(weight.pools, weight.wrestlers, weight, tournament_id, @matches) + @matches = Pool.new.generatePools(weight, tournament_id, @matches) @weight_matches = @matches.select{|m| m.weight_id == weight.id } @last_match = @weight_matches.sort_by{|m| m.round}.last @highest_round = @last_match.round