mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added eight pools to quarter final bracket
This commit is contained in:
@@ -93,7 +93,7 @@ class Tournament < ActiveRecord::Base
|
||||
|
||||
def pool_to_bracket_weights_with_too_many_wrestlers
|
||||
if self.tournament_type == "Pool to bracket"
|
||||
weightsWithTooManyWrestlers = weights.select{|w| w.wrestlers.size > 16}
|
||||
weightsWithTooManyWrestlers = weights.select{|w| w.wrestlers.size > 24}
|
||||
if weightsWithTooManyWrestlers.size < 1
|
||||
return nil
|
||||
else
|
||||
|
||||
@@ -56,6 +56,8 @@ class Weight < ActiveRecord::Base
|
||||
self.pools = 2
|
||||
elsif (@wrestlers.size > 10) && (@wrestlers.size <= 16)
|
||||
self.pools = 4
|
||||
elsif (@wrestlers.size > 16) && (@wrestlers.size <= 24)
|
||||
self.pools = 8
|
||||
end
|
||||
end
|
||||
|
||||
@@ -83,6 +85,8 @@ class Weight < ActiveRecord::Base
|
||||
return "fourPoolsToQuarter"
|
||||
elsif self.wrestlers.size > 12 && self.wrestlers.size <= 16
|
||||
return "fourPoolsToSemi"
|
||||
elsif self.wrestlers.size > 16 && self.wrestlers.size <= 24
|
||||
return "eightPoolsToQuarter"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -21,7 +21,7 @@ class PoolToBracketGenerateLoserNames
|
||||
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"
|
||||
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"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<br>
|
||||
<h4>Features</h4>
|
||||
<br>
|
||||
<p>At this moment in time, WrestlingDev supports a pool to bracket type tournament for up to 16 teams. The bracket format follows OHSAA's 5 match per day rule. WrestlingDev will automatically generate brackets, generate bout numbers, generate and update a bout board, track team points, and update brackets.</p>
|
||||
<p>At this moment in time, WrestlingDev supports a pool to bracket type tournament for up to 24 wrestlers per weight. The bracket format follows OHSAA's 5 match per day rule. WrestlingDev will automatically generate brackets, generate bout numbers, generate and update a bout board, track team points, and update brackets.</p>
|
||||
<p>For pool to bracket tournaments, pool tie breakers are the following:</p>
|
||||
<ul>
|
||||
<li>Least team points deducted</li>
|
||||
@@ -38,9 +38,19 @@
|
||||
</ul>
|
||||
<p>Finals matches will only recieve extra placement points for placing higher and bonus points for pin, tech, major, etc. Please note, only brackets with four pools place up to 8. Brackets with 1 or 2 pools only place top 4.</p>
|
||||
<br>
|
||||
<h4>Pool Types</h4>
|
||||
<ul>
|
||||
<li>Single pool round robin - 2-5 wrestlers, place 1-4.</li>
|
||||
<li>Two Pools of 4 (3 matches each) to a semi final bracket - 6-8 wrestlers, place 1-4.</li>
|
||||
<li>Two Pools of 5 (4 matches each) to a championship and 3rd/4th match - 8-10 wrestlers, place 1-4.</li>
|
||||
<li>Four pools of 3 (2 matches each) to a quarter final bracket - 9-12 wrestlers, place 1-8.</li>
|
||||
<li>Four pools of 4 (3 matches each) to a semi final bracket - 13-16 wrestlers, place 1-8.</li>
|
||||
<li>Eight pools of 3 (2 matches each) to a quarter final bracket - 17-24 wrestlers, place 1-8.</li>
|
||||
</ul>
|
||||
<br>
|
||||
<h4>Future Plans</h4>
|
||||
<br>
|
||||
<p>Future development plans to support normal double elimination brackets are underway and are planned to be finished in time for the 2016-2017 wrestling season.</p>
|
||||
<p>Future development plans to support normal double elimination brackets are underway.</p>
|
||||
<br>
|
||||
<h4>Contact</h4>
|
||||
<br>
|
||||
|
||||
@@ -86,7 +86,7 @@ li:first-child,li:last-child {
|
||||
<% if w.pool_bracket_type == "twoPoolsToSemi" %>
|
||||
<%= render 'twoPoolSemiBracket' %>
|
||||
<% end %>
|
||||
<% if w.pool_bracket_type == "fourPoolsToQuarter" %>
|
||||
<% if w.pool_bracket_type == "fourPoolsToQuarter" or w.pool_bracket_type == "eightPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if w.pool_bracket_type == "fourPoolsToSemi" %>
|
||||
|
||||
@@ -80,6 +80,9 @@ li:first-child,li:last-child {
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "eightPoolsToQuarter" %>
|
||||
<%= render 'fourPoolQuarterBracket' %>
|
||||
<% end %>
|
||||
<% if @weight.pool_bracket_type == "fourPoolsToSemi" %>
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
|
||||
26
db/seeds.rb
26
db/seeds.rb
@@ -19,6 +19,7 @@
|
||||
Weight.create(id: 202, max: 113, tournament_id: 200 )
|
||||
Weight.create(id: 203, max: 120, tournament_id: 200 )
|
||||
Weight.create(id: 204, max: 126, tournament_id: 200 )
|
||||
Weight.create(id: 205, max: 138, tournament_id: 200 )
|
||||
Mat.create(id: 200, name: "1", tournament_id: 200 )
|
||||
Mat.create(id: 201, name: "2", tournament_id: 200 )
|
||||
Mat.create(id: 202, name: "3", tournament_id: 200 )
|
||||
@@ -75,6 +76,31 @@
|
||||
Wrestler.create(name: 'Guy 50', school_id: 204, weight_id: 204, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 51', school_id: 204, weight_id: 204, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 52', school_id: 204, weight_id: 204, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
|
||||
Wrestler.create(name: 'Guy 53', school_id: 204, weight_id: 205, original_seed: 1, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 54', school_id: 204, weight_id: 205, original_seed: 2, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 55', school_id: 204, weight_id: 205, original_seed: 3, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 56', school_id: 204, weight_id: 205, original_seed: 4, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 57', school_id: 204, weight_id: 205, original_seed: 5, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 58', school_id: 204, weight_id: 205, original_seed: 6, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 59', school_id: 204, weight_id: 205, original_seed: 7, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 60', school_id: 204, weight_id: 205, original_seed: 8, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 61', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 62', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 63', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 64', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 65', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 66', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 67', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 68', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 69', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 70', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 71', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 72', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 73', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 74', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 75', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
Wrestler.create(name: 'Guy 76', school_id: 204, weight_id: 205, original_seed: nil, season_win: 0, season_loss: 0, criteria: 'N/A')
|
||||
#end
|
||||
|
||||
|
||||
|
||||
5
test/fixtures/mats.yml
vendored
5
test/fixtures/mats.yml
vendored
@@ -16,3 +16,8 @@
|
||||
name: 1
|
||||
tournament_id: 2
|
||||
id: 2
|
||||
|
||||
eight_pools_generation_mat:
|
||||
name: 1
|
||||
tournament_id: 4
|
||||
id: 3
|
||||
4
test/fixtures/schools.yml
vendored
4
test/fixtures/schools.yml
vendored
@@ -20,3 +20,7 @@ swap_wrestlers:
|
||||
name: Central Crossing
|
||||
tournament_id: 3
|
||||
|
||||
eight_pools_generation_school:
|
||||
id: 5
|
||||
name: Central Crossing
|
||||
tournament_id: 4
|
||||
10
test/fixtures/tournaments.yml
vendored
10
test/fixtures/tournaments.yml
vendored
@@ -29,3 +29,13 @@ swap_wrestlers_tournament:
|
||||
tournament_type: Pool to bracket
|
||||
user_id: 1
|
||||
date: 2015-12-30
|
||||
|
||||
eight_pools_generation_tournament:
|
||||
id: 4
|
||||
name: Comet Classic 2
|
||||
address: Some Place
|
||||
director: Jacob Cody Wimer
|
||||
director_email: jacob.wimer@gmail.com
|
||||
tournament_type: Pool to bracket
|
||||
user_id: 1
|
||||
date: 2015-12-30
|
||||
5
test/fixtures/weights.yml
vendored
5
test/fixtures/weights.yml
vendored
@@ -35,3 +35,8 @@ swap_wrestlers:
|
||||
id: 7
|
||||
max: 138
|
||||
tournament_id: 3
|
||||
|
||||
eight_pools_generation_weight:
|
||||
id: 8
|
||||
max: 138
|
||||
tournament_id: 4
|
||||
228
test/fixtures/wrestlers.yml
vendored
228
test/fixtures/wrestlers.yml
vendored
@@ -771,7 +771,229 @@ swap_wrestlers_wrestler_8:
|
||||
criteria:
|
||||
extra:
|
||||
|
||||
eight_pools_generation_wrestler_1:
|
||||
name: Guy1
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_2:
|
||||
name: Guy2
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 2
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
|
||||
|
||||
|
||||
|
||||
eight_pools_generation_wrestler_3:
|
||||
name: Guy3
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 3
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_4:
|
||||
name: Guy4
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 4
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_5:
|
||||
name: Guy5
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 5
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_6:
|
||||
name: Guy6
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 6
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_7:
|
||||
name: Guy7
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 7
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_8:
|
||||
name: Guy8
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 8
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_9:
|
||||
name: Guy9
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_9:
|
||||
name: Guy9
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_10:
|
||||
name: Guy10
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed: 1
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_11:
|
||||
name: Guy11
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_12:
|
||||
name: Guy12
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_13:
|
||||
name: Guy13
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_14:
|
||||
name: Guy14
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_15:
|
||||
name: Guy15
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_16:
|
||||
name: Guy16
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_17:
|
||||
name: Guy17
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_18:
|
||||
name: Guy18
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_19:
|
||||
name: Guy19
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_20:
|
||||
name: Guy20
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_21:
|
||||
name: Guy21
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_22:
|
||||
name: Guy22
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_23:
|
||||
name: Guy23
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
eight_pools_generation_wrestler_24:
|
||||
name: Guy24
|
||||
school_id: 5
|
||||
weight_id: 8
|
||||
original_seed:
|
||||
season_loss: 0
|
||||
season_win: 0
|
||||
criteria:
|
||||
extra:
|
||||
|
||||
84
test/integration/eight_pool_match_generation_test.rb
Normal file
84
test/integration/eight_pool_match_generation_test.rb
Normal file
@@ -0,0 +1,84 @@
|
||||
require 'test_helper'
|
||||
|
||||
class EightPoolMatchGenerationTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@tournament = Tournament.find(4)
|
||||
end
|
||||
|
||||
test "Match generation works" do
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
assert @tournament.matches.count == 36
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter"}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Semis"}.count == 2
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis"}.count == 2
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "1/2"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "5/6"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "7/8"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Pool"}.count == 24
|
||||
assert @tournament.weights.first.pools == 8
|
||||
end
|
||||
|
||||
test "Seeded wrestlers go to correct pool" do
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
guy10 = @tournament.wrestlers.select{|w| w.name == "Guy10"}.first
|
||||
guy2 = @tournament.wrestlers.select{|w| w.name == "Guy2"}.first
|
||||
guy3 = @tournament.wrestlers.select{|w| w.name == "Guy3"}.first
|
||||
guy4 = @tournament.wrestlers.select{|w| w.name == "Guy4"}.first
|
||||
guy5 = @tournament.wrestlers.select{|w| w.name == "Guy5"}.first
|
||||
guy6 = @tournament.wrestlers.select{|w| w.name == "Guy6"}.first
|
||||
guy7 = @tournament.wrestlers.select{|w| w.name == "Guy7"}.first
|
||||
guy8 = @tournament.wrestlers.select{|w| w.name == "Guy8"}.first
|
||||
assert guy10.pool == 1
|
||||
assert guy2.pool == 2
|
||||
assert guy3.pool == 3
|
||||
assert guy4.pool == 4
|
||||
assert guy5.pool == 5
|
||||
assert guy6.pool == 6
|
||||
assert guy7.pool == 7
|
||||
assert guy8.pool == 8
|
||||
end
|
||||
|
||||
test "Loser names set up correctly" do
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 1}.first.loser1_name == "Winner Pool 1"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 1}.first.loser2_name == "Winner Pool 8"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 2}.first.loser1_name == "Winner Pool 4"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 2}.first.loser2_name == "Winner Pool 5"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 3}.first.loser1_name == "Winner Pool 2"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 3}.first.loser2_name == "Winner Pool 7"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 4}.first.loser1_name == "Winner Pool 3"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter" && m.bracket_position_number == 4}.first.loser2_name == "Winner Pool 6"
|
||||
quarters = @tournament.matches.reload.select{|m| m.bracket_position == "Quarter"}
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis" && m.bracket_position_number == 1}.first.loser1_name == "Loser of #{quarters.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis" && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{quarters.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis" && m.bracket_position_number == 2}.first.loser1_name == "Loser of #{quarters.select{|m| m.bracket_position_number == 3}.first.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis" && m.bracket_position_number == 2}.first.loser2_name == "Loser of #{quarters.select{|m| m.bracket_position_number == 4}.first.bout_number}"
|
||||
thirdFourth = @tournament.matches.reload.select{|m| m.bracket_position == "3/4"}.first
|
||||
seventhEighth = @tournament.matches.reload.select{|m| m.bracket_position == "7/8"}.first
|
||||
consoSemis = @tournament.matches.reload.select{|m| m.bracket_position == "Conso Semis"}
|
||||
assert seventhEighth.loser1_name == "Loser of #{consoSemis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
|
||||
assert seventhEighth.loser2_name == "Loser of #{consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
|
||||
end
|
||||
|
||||
test "Each wrestler has two pool matches" do
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
@tournament.wrestlers.each do |wrestler|
|
||||
assert wrestler.pool_matches.size == 2
|
||||
end
|
||||
end
|
||||
|
||||
test "Placement points are given when moving through bracket" do
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
match = @tournament.matches.select{|m| m.bracket_position == "Quarter"}.first
|
||||
wrestler = @tournament.wrestlers.select{|w| w.name == "Guy10"}.first
|
||||
match.w1 = wrestler.id
|
||||
match.save
|
||||
assert wrestler.reload.placement_points == 3
|
||||
|
||||
match2 = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
|
||||
match2.w1 = wrestler.id
|
||||
match2.save
|
||||
assert wrestler.reload.placement_points == 9
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user