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

remove another argument from roundRobin

This commit is contained in:
RJ Osborne
2015-05-23 06:38:55 -04:00
parent aec47ddf13
commit 23d8c4e159

View File

@@ -8,22 +8,26 @@ class Pool
matches = [] matches = []
pools = @weight.pools pools = @weight.pools
while @pool <= pools while @pool <= pools
matches += roundRobin(@weight) matches += roundRobin()
@pool += 1 @pool += 1
end end
return matches return matches
end end
def roundRobin(weight) def roundRobin
matches = [] matches = []
@wrestlers = weight.wrestlers.select{|w| w.generatePoolNumber == @pool}.to_a wrestlers = @weight.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|
round = index + 1 round = index + 1
@bout = b.map bouts = b.map
@bout.each do |bout| bouts.each do |bout|
if bout[0] != nil and bout[1] != nil if bout[0] != nil and bout[1] != nil
match = Match.new(w1: bout[0].id, w2: bout[1].id, weight_id: weight.id, round: round) match = Match.new(
w1: bout[0].id,
w2: bout[1].id,
weight_id: @weight.id,
round: round)
matches << match matches << match
end end
end end