1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-03 13:30:02 +00:00

Speeding up tests and renaming a few methods in generateMatchups

This commit is contained in:
2016-03-26 03:54:31 +00:00
parent f66725d750
commit ddcf2d807e
17 changed files with 2814 additions and 729 deletions

View File

@@ -6,17 +6,14 @@ class Pool
end
def generatePools
matches = []
pools = @weight.pools
while @pool <= pools
matches += roundRobin()
roundRobin
@pool += 1
end
return matches
end
def roundRobin
matches = []
wrestlers = @weight.wrestlersForPool(@pool)
poolMatches = RoundRobinTournament.schedule(wrestlers).reverse
poolMatches.each_with_index do |b, index|
@@ -24,16 +21,14 @@ class Pool
bouts = b.map
bouts.each do |bout|
if bout[0] != nil and bout[1] != nil
match = @tournament.matches.create(
@tournament.matches.create(
w1: bout[0].id,
w2: bout[1].id,
weight_id: @weight.id,
bracket_position: "Pool",
round: round)
matches << match
end
end
end
matches
end
end