1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

generatePools has a nicer arity

This commit is contained in:
R.J. Osborne
2015-05-18 19:37:13 -04:00
parent b6da441d54
commit b56d72c762
2 changed files with 6 additions and 6 deletions

View File

@@ -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
end

View File

@@ -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