mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-05 06:07:20 +00:00
Added eight pools to quarter final bracket
This commit is contained in:
@@ -20,6 +20,8 @@ class PoolBracketGeneration
|
||||
return fourPoolsToQuarter()
|
||||
elsif @pool_bracket_type == "fourPoolsToSemi"
|
||||
return fourPoolsToSemi()
|
||||
elsif @pool_bracket_type == "eightPoolsToQuarter"
|
||||
return eightPoolsToQuarter()
|
||||
end
|
||||
return []
|
||||
end
|
||||
@@ -66,6 +68,23 @@ class PoolBracketGeneration
|
||||
createMatchup("", "", "7/8", 1)
|
||||
end
|
||||
|
||||
def eightPoolsToQuarter()
|
||||
createMatchup("Winner Pool 1", "Winner Pool 8", "Quarter", 1)
|
||||
createMatchup("Winner Pool 4", "Winner Pool 5", "Quarter", 2)
|
||||
createMatchup("Winner Pool 2", "Winner Pool 7", "Quarter", 3)
|
||||
createMatchup("Winner Pool 3", "Winner Pool 6", "Quarter", 4)
|
||||
next_round
|
||||
createMatchup("", "", "Semis", 1)
|
||||
createMatchup("", "", "Semis", 2)
|
||||
createMatchup("", "", "Conso Semis", 1)
|
||||
createMatchup("", "", "Conso Semis", 2)
|
||||
next_round
|
||||
createMatchup("", "", "1/2", 1)
|
||||
createMatchup("", "", "3/4", 1)
|
||||
createMatchup("", "", "5/6", 1)
|
||||
createMatchup("", "", "7/8", 1)
|
||||
end
|
||||
|
||||
def createMatchup(w1_name, w2_name, bracket_position, bracket_position_number)
|
||||
@tournament.matches.create(
|
||||
loser1_name: w1_name,
|
||||
|
||||
@@ -7,7 +7,7 @@ class PoolToBracketGenerateLoserNames
|
||||
matches_by_weight = @tournament.matches.where(weight_id: weight.id)
|
||||
if weight.pool_bracket_type == "twoPoolsToSemi"
|
||||
twoPoolsToSemiLoser(matches_by_weight)
|
||||
elsif weight.pool_bracket_type == "fourPoolsToQuarter"
|
||||
elsif (weight.pool_bracket_type == "fourPoolsToQuarter") or (weight.pool_bracket_type == "eightPoolsToQuarter")
|
||||
fourPoolsToQuarterLoser(matches_by_weight)
|
||||
elsif weight.pool_bracket_type == "fourPoolsToSemi"
|
||||
fourPoolsToSemiLoser(matches_by_weight)
|
||||
@@ -20,8 +20,8 @@ class PoolToBracketGenerateLoserNames
|
||||
@tournament.weights.each do |w|
|
||||
matches_by_weight = @tournament.matches.where(weight_id: w.id)
|
||||
if w.pool_bracket_type == "twoPoolsToSemi"
|
||||
twoPoolsToSemiLoser(matches_by_weight)
|
||||
elsif w.pool_bracket_type == "fourPoolsToQuarter"
|
||||
twoPoolsToSemiLoser(matches_by_weight)
|
||||
elsif (w.pool_bracket_type == "fourPoolsToQuarter") or (w.pool_bracket_type == "eightPoolsToQuarter")
|
||||
fourPoolsToQuarterLoser(matches_by_weight)
|
||||
elsif w.pool_bracket_type == "fourPoolsToSemi"
|
||||
fourPoolsToSemiLoser(matches_by_weight)
|
||||
|
||||
@@ -10,6 +10,8 @@ class GeneratePoolNumbers
|
||||
saveTwoPoolNumbers(@weight.wrestlers_without_pool_assignment)
|
||||
elsif @weight.pools == 1
|
||||
saveOnePoolNumbers(@weight.wrestlers_without_pool_assignment)
|
||||
elsif @weight.pools == 8
|
||||
saveEightPoolNumbers(@weight.wrestlers_without_pool_assignment)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,4 +76,35 @@ class GeneratePoolNumbers
|
||||
w.save
|
||||
end
|
||||
end
|
||||
|
||||
def saveEightPoolNumbers(poolWrestlers)
|
||||
pool = 1
|
||||
poolWrestlers.sort_by{|x| x.bracket_line }.reverse.each do |w|
|
||||
if w.bracket_line == 1
|
||||
w.pool = 1
|
||||
elsif w.bracket_line == 2
|
||||
w.pool = 2
|
||||
elsif w.bracket_line == 3
|
||||
w.pool = 3
|
||||
elsif w.bracket_line == 4
|
||||
w.pool = 4
|
||||
elsif w.bracket_line == 5
|
||||
w.pool = 5
|
||||
elsif w.bracket_line == 6
|
||||
w.pool = 6
|
||||
elsif w.bracket_line == 7
|
||||
w.pool = 7
|
||||
elsif w.bracket_line == 8
|
||||
w.pool = 8
|
||||
else
|
||||
w.pool = pool
|
||||
end
|
||||
if pool < 8
|
||||
pool = pool + 1
|
||||
else
|
||||
pool = 1
|
||||
end
|
||||
w.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@ class PoolBracketPlacementPoints
|
||||
if @bracket == "twoPoolsToSemi"
|
||||
whilePointsAreZero { @points = twoPoolsToSemi }
|
||||
end
|
||||
if @bracket == "fourPoolsToQuarter"
|
||||
if (@bracket == "fourPoolsToQuarter") or (@bracket == "eightPoolsToQuarter")
|
||||
whilePointsAreZero { @points = fourPoolsToQuarter }
|
||||
end
|
||||
if @bracket == "fourPoolsToSemi"
|
||||
|
||||
Reference in New Issue
Block a user