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

An instance variable doesn't need to be passed around inside the class as an argument

This commit is contained in:
R.J. Osborne
2015-05-18 21:28:04 -04:00
parent b56d72c762
commit 80dee9c234

View File

@@ -3,14 +3,14 @@ class Pool
@pools = weight.pools @pools = weight.pools
@pool = 1 @pool = 1
while @pool <= @pools while @pool <= @pools
matches = roundRobin(@pool, weight.wrestlers, weight, tournament , matches) matches = roundRobin(weight.wrestlers, weight, tournament , matches)
@pool += 1 @pool += 1
end end
return matches return matches
end end
def roundRobin(pool,wrestlers,weight,tournament,matches) def roundRobin(wrestlers,weight,tournament,matches)
@wrestlers = wrestlers.select{|w| w.generatePoolNumber == pool}.to_a @wrestlers = wrestlers.select{|w| w.generatePoolNumber == @pool}.to_a
@poolMatches = RoundRobinTournament.schedule(@wrestlers).reverse @poolMatches = RoundRobinTournament.schedule(@wrestlers).reverse
@poolMatches.each_with_index do |b,index| @poolMatches.each_with_index do |b,index|
@bout = b.map @bout = b.map