mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-13 00:26:31 +00:00
generatePools has a nicer arity
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
class Pool
|
class Pool
|
||||||
def generatePools(pools,wrestlers,weight,tournament,matches)
|
def generatePools(weight, tournament, matches)
|
||||||
@pools = pools
|
@pools = weight.pools
|
||||||
@pool = 1
|
@pool = 1
|
||||||
while @pool <= @pools
|
while @pool <= @pools
|
||||||
matches = roundRobin(@pool,wrestlers,weight,tournament,matches)
|
matches = roundRobin(@pool, weight.wrestlers, weight, tournament , matches)
|
||||||
@pool = @pool + 1
|
@pool += 1
|
||||||
end
|
end
|
||||||
return matches
|
return matches
|
||||||
end
|
end
|
||||||
@@ -27,4 +27,4 @@ class Pool
|
|||||||
end
|
end
|
||||||
return matches
|
return matches
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class Tournamentmatchgen
|
|||||||
|
|
||||||
def buildTournamentWeights(tournament_id, weight)
|
def buildTournamentWeights(tournament_id, weight)
|
||||||
@wrestlers = weight.wrestlers
|
@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 }
|
@weight_matches = @matches.select{|m| m.weight_id == weight.id }
|
||||||
@last_match = @weight_matches.sort_by{|m| m.round}.last
|
@last_match = @weight_matches.sort_by{|m| m.round}.last
|
||||||
@highest_round = @last_match.round
|
@highest_round = @last_match.round
|
||||||
|
|||||||
Reference in New Issue
Block a user