mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-07 23:17:25 +00:00
Speeding up tests and renaming a few methods in generateMatchups
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -60,3 +60,4 @@ gem 'spring', :group => :development
|
|||||||
|
|
||||||
#gem 'bullet'
|
#gem 'bullet'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ module GeneratesTournamentMatches
|
|||||||
poolToBracket() if tournament_type == "Pool to bracket"
|
poolToBracket() if tournament_type == "Pool to bracket"
|
||||||
self.curently_generating_matches = nil
|
self.curently_generating_matches = nil
|
||||||
self.save
|
self.save
|
||||||
matches
|
|
||||||
end
|
end
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
handle_asynchronously :generateMatchups
|
handle_asynchronously :generateMatchups
|
||||||
@@ -16,13 +15,11 @@ module GeneratesTournamentMatches
|
|||||||
|
|
||||||
def poolToBracket
|
def poolToBracket
|
||||||
destroyAllMatches
|
destroyAllMatches
|
||||||
buildTournamentWeights
|
generatePoolToBracketMatches
|
||||||
generateMatches
|
poolToBracketPostMatchCreation
|
||||||
# This is not working for pool order and I cannot get tests working
|
|
||||||
movePoolSeedsToFinalPoolRound
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def buildTournamentWeights
|
def generatePoolToBracketMatches
|
||||||
weights.order(:max).each do |weight|
|
weights.order(:max).each do |weight|
|
||||||
Pool.new(weight).generatePools()
|
Pool.new(weight).generatePools()
|
||||||
last_match = matches.where(weight: weight).order(round: :desc).limit(1).first
|
last_match = matches.where(weight: weight).order(round: :desc).limit(1).first
|
||||||
@@ -31,11 +28,12 @@ module GeneratesTournamentMatches
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def generateMatches
|
def poolToBracketPostMatchCreation
|
||||||
moveFinalsMatchesToLastRound
|
moveFinalsMatchesToLastRound
|
||||||
assignBouts
|
assignBouts
|
||||||
assignLoserNames
|
assignLoserNames
|
||||||
assignFirstMatchesToMats
|
assignFirstMatchesToMats
|
||||||
|
movePoolSeedsToFinalPoolRound
|
||||||
end
|
end
|
||||||
|
|
||||||
def moveFinalsMatchesToLastRound
|
def moveFinalsMatchesToLastRound
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ class Match < ActiveRecord::Base
|
|||||||
|
|
||||||
|
|
||||||
after_update do
|
after_update do
|
||||||
|
after_update_actions
|
||||||
|
end
|
||||||
|
|
||||||
|
def after_update_actions
|
||||||
if self.finished == 1 && self.winner_id != nil
|
if self.finished == 1 && self.winner_id != nil
|
||||||
if self.w1 && self.w2
|
if self.w1 && self.w2
|
||||||
wrestler1.touch
|
wrestler1.touch
|
||||||
|
|||||||
@@ -6,17 +6,14 @@ class Pool
|
|||||||
end
|
end
|
||||||
|
|
||||||
def generatePools
|
def generatePools
|
||||||
matches = []
|
|
||||||
pools = @weight.pools
|
pools = @weight.pools
|
||||||
while @pool <= pools
|
while @pool <= pools
|
||||||
matches += roundRobin()
|
roundRobin
|
||||||
@pool += 1
|
@pool += 1
|
||||||
end
|
end
|
||||||
return matches
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def roundRobin
|
def roundRobin
|
||||||
matches = []
|
|
||||||
wrestlers = @weight.wrestlersForPool(@pool)
|
wrestlers = @weight.wrestlersForPool(@pool)
|
||||||
poolMatches = RoundRobinTournament.schedule(wrestlers).reverse
|
poolMatches = RoundRobinTournament.schedule(wrestlers).reverse
|
||||||
poolMatches.each_with_index do |b, index|
|
poolMatches.each_with_index do |b, index|
|
||||||
@@ -24,16 +21,14 @@ class Pool
|
|||||||
bouts = b.map
|
bouts = b.map
|
||||||
bouts.each do |bout|
|
bouts.each do |bout|
|
||||||
if bout[0] != nil and bout[1] != nil
|
if bout[0] != nil and bout[1] != nil
|
||||||
match = @tournament.matches.create(
|
@tournament.matches.create(
|
||||||
w1: bout[0].id,
|
w1: bout[0].id,
|
||||||
w2: bout[1].id,
|
w2: bout[1].id,
|
||||||
weight_id: @weight.id,
|
weight_id: @weight.id,
|
||||||
bracket_position: "Pool",
|
bracket_position: "Pool",
|
||||||
round: round)
|
round: round)
|
||||||
matches << match
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
matches
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Weight < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
before_save do
|
before_save do
|
||||||
self.tournament.destroyAllMatches
|
# self.tournament.destroyAllMatches
|
||||||
end
|
end
|
||||||
|
|
||||||
def wrestlersForPool(pool)
|
def wrestlersForPool(pool)
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ class MatchesControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@match = @tournament.matches.first
|
@match = Match.where("tournament_id = ? and mat_id = ?",1,1).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_update
|
def post_update
|
||||||
patch :update, id: @match.id, match: {w1: @match.w1, w2: @match.w2}
|
patch :update, id: @match.id, match: {tournament_id: 1, mat_id: 1}
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_edit
|
def get_edit
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class MatsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@mat = mats(:one)
|
@mat = mats(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class SchoolsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@school = @tournament.schools.first
|
@school = @tournament.schools.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class StaticPagesControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@school = @tournament.schools.first
|
@school = @tournament.schools.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ include Devise::TestHelpers
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@school = @tournament.schools.first
|
@school = @tournament.schools.first
|
||||||
@wrestlers = @tournament.weights.first.wrestlers
|
@wrestlers = @tournament.weights.first.wrestlers
|
||||||
@adjust = Teampointadjust.find(1)
|
@adjust = Teampointadjust.find(1)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class WeightsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@weight = @tournament.weights.first
|
@weight = @tournament.weights.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class WrestlersControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
setup do
|
setup do
|
||||||
@tournament = Tournament.find(1)
|
@tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
# @tournament.generateMatchups
|
||||||
@school = @tournament.schools.first
|
@school = @tournament.schools.first
|
||||||
@wrestler = @school.wrestlers.first
|
@wrestler = @school.wrestlers.first
|
||||||
end
|
end
|
||||||
|
|||||||
2035
test/fixtures/matches.yml
vendored
2035
test/fixtures/matches.yml
vendored
File diff suppressed because it is too large
Load Diff
910
test/fixtures/wrestlers.yml
vendored
910
test/fixtures/wrestlers.yml
vendored
@@ -1,487 +1,531 @@
|
|||||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
one:
|
wrestler1:
|
||||||
name: Zach Collins
|
id: 1
|
||||||
school_id: 1
|
name: Jackson Lakso
|
||||||
weight_id: 1
|
school_id: 1
|
||||||
original_seed: 4
|
weight_id: 1
|
||||||
season_loss: 8
|
original_seed: 3
|
||||||
season_win: 30
|
season_loss: 8
|
||||||
criteria: DP 5th
|
season_win: 30
|
||||||
|
criteria: SQ
|
||||||
|
|
||||||
two:
|
wrestler2:
|
||||||
name: Jaden Mattox
|
id: 2
|
||||||
school_id: 1
|
name: JD Woods
|
||||||
weight_id: 1
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 1
|
||||||
season_loss: 3
|
original_seed: 5
|
||||||
season_win: 49
|
season_loss: 12
|
||||||
criteria: SP 2nd
|
season_win: 30
|
||||||
|
criteria: DP 6th
|
||||||
|
|
||||||
three:
|
wrestler3:
|
||||||
name: Jackson Lakso
|
id: 3
|
||||||
school_id: 1
|
name: Jaden Mattox
|
||||||
weight_id: 1
|
school_id: 1
|
||||||
original_seed: 3
|
weight_id: 1
|
||||||
season_loss: 8
|
original_seed: 1
|
||||||
season_win: 30
|
season_loss: 3
|
||||||
criteria: SQ
|
season_win: 49
|
||||||
|
criteria: SP 2nd
|
||||||
|
|
||||||
four:
|
wrestler4:
|
||||||
name: JD Woods
|
id: 4
|
||||||
school_id: 1
|
name: Zach Collins
|
||||||
weight_id: 1
|
school_id: 1
|
||||||
original_seed: 5
|
weight_id: 1
|
||||||
season_loss: 12
|
original_seed: 4
|
||||||
season_win: 30
|
season_loss: 8
|
||||||
criteria: DP 6th
|
season_win: 30
|
||||||
|
criteria: DP 5th
|
||||||
|
|
||||||
five:
|
wrestler5:
|
||||||
name: James Wimer
|
id: 5
|
||||||
school_id: 1
|
name: James Wimer
|
||||||
weight_id: 1
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 1
|
||||||
season_loss: 12
|
original_seed: 2
|
||||||
season_win: 49
|
season_loss: 12
|
||||||
criteria: SP 5th
|
season_win: 49
|
||||||
|
criteria: SP 5th
|
||||||
|
|
||||||
six:
|
wrestler6:
|
||||||
name: Derek Wurzauf
|
id: 6
|
||||||
school_id: 1
|
name: Derek Wurzauf
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 6
|
weight_id: 2
|
||||||
season_loss: 15
|
original_seed: 6
|
||||||
season_win: 16
|
season_loss: 15
|
||||||
criteria:
|
season_win: 16
|
||||||
|
criteria:
|
||||||
|
|
||||||
seven:
|
wrestler7:
|
||||||
name: Casey Davis
|
id: 7
|
||||||
school_id: 1
|
name: Casey Davis
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 5
|
weight_id: 2
|
||||||
season_loss: 15
|
original_seed: 5
|
||||||
season_win: 16
|
season_loss: 15
|
||||||
criteria: DQ
|
season_win: 16
|
||||||
|
criteria: DQ
|
||||||
|
|
||||||
eight:
|
wrestler8:
|
||||||
name: Ethan Leapley
|
id: 8
|
||||||
school_id: 1
|
name: Kameron Teacher
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 4
|
weight_id: 2
|
||||||
season_loss: 15
|
original_seed: 2
|
||||||
season_win: 20
|
season_loss: 2
|
||||||
criteria: DP 6th
|
season_win: 50
|
||||||
|
criteria: SQ
|
||||||
|
|
||||||
nine:
|
wrestler9:
|
||||||
name: Clayton Ray
|
id: 9
|
||||||
school_id: 1
|
name: Robbie Fusner
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 2
|
||||||
season_loss: 4
|
original_seed: 3
|
||||||
season_win: 30
|
season_loss: 5
|
||||||
criteria: SP 7th
|
season_win: 40
|
||||||
|
criteria: SQ
|
||||||
|
|
||||||
ten:
|
wrestler10:
|
||||||
name: Robbie Fusner
|
id: 10
|
||||||
school_id: 1
|
name: Guy1
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 3
|
weight_id: 2
|
||||||
season_loss: 5
|
original_seed: 7
|
||||||
season_win: 40
|
season_loss: 2
|
||||||
criteria: SQ
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
eleven:
|
wrestler11:
|
||||||
name: Kameron Teacher
|
id: 11
|
||||||
school_id: 1
|
name: Ethan Leapley
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 2
|
||||||
season_loss: 2
|
original_seed: 4
|
||||||
season_win: 50
|
season_loss: 15
|
||||||
criteria: SQ
|
season_win: 20
|
||||||
|
criteria: DP 6th
|
||||||
|
|
||||||
twelve:
|
wrestler12:
|
||||||
name: Guy1
|
id: 12
|
||||||
school_id: 1
|
name: Clayton Ray
|
||||||
weight_id: 2
|
school_id: 1
|
||||||
original_seed: 7
|
weight_id: 2
|
||||||
season_loss: 2
|
original_seed: 1
|
||||||
season_win: 50
|
season_loss: 4
|
||||||
criteria:
|
season_win: 30
|
||||||
|
criteria: SP 7th
|
||||||
|
|
||||||
thirteen:
|
wrestler13:
|
||||||
name: Guy2
|
id: 13
|
||||||
school_id: 1
|
name: Guy2
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 1
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourteen:
|
wrestler14:
|
||||||
name: Guy3
|
id: 14
|
||||||
school_id: 1
|
name: Guy9
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 8
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fifteen:
|
wrestler15:
|
||||||
name: Guy4
|
id: 15
|
||||||
school_id: 1
|
name: Guy7
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 3
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 6
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
sixteen:
|
wrestler16:
|
||||||
name: Guy5
|
id: 16
|
||||||
school_id: 1
|
name: Guy3
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 4
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 2
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
seventeen:
|
wrestler17:
|
||||||
name: Guy6
|
id: 17
|
||||||
school_id: 1
|
name: Guy4
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 5
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 3
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
eighteen:
|
wrestler18:
|
||||||
name: Guy7
|
id: 18
|
||||||
school_id: 1
|
name: Guy8
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 6
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 7
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
ninteen:
|
wrestler19:
|
||||||
name: Guy8
|
id: 19
|
||||||
school_id: 1
|
name: Guy10
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 7
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 9
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twenty:
|
wrestler20:
|
||||||
name: Guy9
|
id: 20
|
||||||
school_id: 1
|
name: Guy6
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 8
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 5
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentyone:
|
wrestler21:
|
||||||
name: Guy10
|
id: 21
|
||||||
school_id: 1
|
name: Guy5
|
||||||
weight_id: 3
|
school_id: 1
|
||||||
original_seed: 9
|
weight_id: 3
|
||||||
season_loss: 2
|
original_seed: 4
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentytwo:
|
wrestler22:
|
||||||
name: Guy11
|
id: 22
|
||||||
school_id: 1
|
name: Guy20
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 10
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentythree:
|
wrestler23:
|
||||||
name: Guy12
|
id: 23
|
||||||
school_id: 1
|
name: Guy12
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 2
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentyfour:
|
wrestler24:
|
||||||
name: Guy13
|
id: 24
|
||||||
school_id: 1
|
name: Guy16
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 3
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 6
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentyfive:
|
wrestler25:
|
||||||
name: Guy14
|
id: 25
|
||||||
school_id: 1
|
name: Guy13
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 4
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 3
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentysix:
|
wrestler26:
|
||||||
name: Guy15
|
id: 26
|
||||||
school_id: 1
|
name: Guy15
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 5
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 5
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twnetyseven:
|
wrestler27:
|
||||||
name: Guy16
|
id: 27
|
||||||
school_id: 1
|
name: Guy21
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 6
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 11
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentyeight:
|
wrestler28:
|
||||||
name: Guy17
|
id: 28
|
||||||
school_id: 1
|
name: Guy11
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 7
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 1
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
twentynine:
|
wrestler29:
|
||||||
name: Guy18
|
id: 29
|
||||||
school_id: 1
|
name: Guy14
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 8
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 4
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirty:
|
wrestler30:
|
||||||
name: Guy19
|
id: 30
|
||||||
school_id: 1
|
name: Guy18
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 9
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 8
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thrityone:
|
wrestler31:
|
||||||
name: Guy20
|
id: 31
|
||||||
school_id: 1
|
name: Guy17
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 10
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 7
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtytwo:
|
wrestler32:
|
||||||
name: Guy21
|
id: 32
|
||||||
school_id: 1
|
name: Guy19
|
||||||
weight_id: 4
|
school_id: 1
|
||||||
original_seed: 11
|
weight_id: 4
|
||||||
season_loss: 2
|
original_seed: 9
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtythree:
|
wrestler33:
|
||||||
name: Guy22
|
id: 33
|
||||||
school_id: 1
|
name: Guy36
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 15
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtyfour:
|
wrestler34:
|
||||||
name: Guy23
|
id: 34
|
||||||
school_id: 1
|
name: Guy31
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 10
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtyfive:
|
wrestler35:
|
||||||
name: Guy24
|
id: 35
|
||||||
school_id: 1
|
name: Guy22
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 3
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 1
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtysix:
|
wrestler36:
|
||||||
name: Guy25
|
id: 36
|
||||||
school_id: 1
|
name: Guy32
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 4
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 11
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtyseven:
|
wrestler37:
|
||||||
name: Guy26
|
id: 37
|
||||||
school_id: 1
|
name: Guy23
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 5
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 2
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtyeight:
|
wrestler38:
|
||||||
name: Guy27
|
id: 38
|
||||||
school_id: 1
|
name: Guy34
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 6
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 13
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
thirtynine:
|
wrestler39:
|
||||||
name: Guy28
|
id: 39
|
||||||
school_id: 1
|
name: Guy29
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 7
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 8
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourty:
|
wrestler40:
|
||||||
name: Guy29
|
id: 40
|
||||||
school_id: 1
|
name: Guy26
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 8
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 5
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtyone:
|
wrestler41:
|
||||||
name: Guy30
|
id: 41
|
||||||
school_id: 1
|
name: Guy35
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 9
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 14
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtytwo:
|
wrestler42:
|
||||||
name: Guy31
|
id: 42
|
||||||
school_id: 1
|
name: Guy30
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 10
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 9
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtythree:
|
wrestler43:
|
||||||
name: Guy32
|
id: 43
|
||||||
school_id: 1
|
name: Guy27
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 11
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 6
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtyfour:
|
wrestler44:
|
||||||
name: Guy33
|
id: 44
|
||||||
school_id: 1
|
name: Guy28
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 12
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 7
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtyfive:
|
wrestler45:
|
||||||
name: Guy34
|
id: 45
|
||||||
school_id: 1
|
name: Guy37
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 13
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 16
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtysix:
|
wrestler46:
|
||||||
name: Guy35
|
id: 46
|
||||||
school_id: 1
|
name: Guy33
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 14
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 12
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtyseven:
|
wrestler47:
|
||||||
name: Guy36
|
id: 47
|
||||||
school_id: 1
|
name: Guy24
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 15
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 3
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtyeight:
|
wrestler48:
|
||||||
name: Guy37
|
id: 48
|
||||||
school_id: 1
|
name: Guy25
|
||||||
weight_id: 5
|
school_id: 1
|
||||||
original_seed: 16
|
weight_id: 5
|
||||||
season_loss: 2
|
original_seed: 4
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtynine:
|
wrestler49:
|
||||||
name: Guy38
|
id: 49
|
||||||
school_id: 1
|
name: Guy42
|
||||||
weight_id: 6
|
school_id: 1
|
||||||
original_seed: 1
|
weight_id: 6
|
||||||
season_loss: 2
|
original_seed:
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fourtynine:
|
wrestler50:
|
||||||
name: Guy39
|
id: 50
|
||||||
school_id: 1
|
name: Guy39
|
||||||
weight_id: 6
|
school_id: 1
|
||||||
original_seed: 2
|
weight_id: 6
|
||||||
season_loss: 2
|
original_seed: 2
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fifty:
|
wrestler51:
|
||||||
name: Guy40
|
id: 51
|
||||||
school_id: 1
|
name: Guy41
|
||||||
weight_id: 6
|
school_id: 1
|
||||||
original_seed:
|
weight_id: 6
|
||||||
season_loss: 2
|
original_seed:
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fiftyone:
|
wrestler52:
|
||||||
name: Guy41
|
id: 52
|
||||||
school_id: 1
|
name: Guy43
|
||||||
weight_id: 6
|
school_id: 1
|
||||||
original_seed:
|
weight_id: 6
|
||||||
season_loss: 2
|
original_seed:
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
|
|
||||||
fiftytwo:
|
wrestler53:
|
||||||
name: Guy42
|
id: 53
|
||||||
school_id: 1
|
name: Guy40
|
||||||
weight_id: 6
|
school_id: 1
|
||||||
original_seed:
|
weight_id: 6
|
||||||
season_loss: 2
|
original_seed:
|
||||||
season_win: 50
|
season_loss: 2
|
||||||
criteria:
|
season_win: 50
|
||||||
|
criteria:
|
||||||
fiftythree:
|
|
||||||
name: Guy43
|
|
||||||
school_id: 1
|
|
||||||
weight_id: 6
|
|
||||||
original_seed:
|
|
||||||
season_loss: 2
|
|
||||||
season_win: 50
|
|
||||||
criteria:
|
|
||||||
@@ -3,129 +3,127 @@ require 'test_helper'
|
|||||||
class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@tournament = Tournament.find(1)
|
tournament = Tournament.find(1)
|
||||||
@tournament.generateMatchups
|
tournament.generateMatchups
|
||||||
@matches = @tournament.matches
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def showMatches
|
# def showMatches
|
||||||
matches = Weight.where("id = ?", 4).first.matches
|
# matches = Weight.where("id = ?", 4).first.matches
|
||||||
# matches = @matches.select{|m| m.weight_id == 4}
|
# matches.each do |m|
|
||||||
matches.each do |m|
|
# puts "Bout: #{m.bout_number} #{m.w1_name} vs #{m.w2_name} #{m.bracket_position} #{m.poolNumber}"
|
||||||
puts "Bout: #{m.bout_number} #{m.w1_name} vs #{m.w2_name} #{m.bracket_position} #{m.poolNumber}"
|
# end
|
||||||
end
|
# end
|
||||||
end
|
|
||||||
|
|
||||||
def singlePoolNotFinished
|
def singlePoolNotFinished
|
||||||
matches = @matches
|
|
||||||
endMatch(1000,"Jackson Lakso",matches)
|
endMatch(1000,"Jackson Lakso")
|
||||||
endMatch(1001,"Jaden Mattox",matches)
|
endMatch(1001,"Jaden Mattox")
|
||||||
endMatch(2000,"James Wimer",matches)
|
endMatch(2000,"James Wimer")
|
||||||
endMatch(2001,"Jaden Mattox",matches)
|
endMatch(2001,"Jaden Mattox")
|
||||||
endMatch(3000,"Jaden Mattox",matches)
|
endMatch(3000,"Jaden Mattox")
|
||||||
endMatch(3001,"James Wimer",matches)
|
endMatch(3001,"James Wimer")
|
||||||
endMatch(4000,"JD Woods",matches)
|
endMatch(4000,"JD Woods")
|
||||||
endMatch(4001,"James Wimer",matches)
|
endMatch(4001,"James Wimer")
|
||||||
endMatch(5000,"James Wimer",matches)
|
endMatch(5000,"James Wimer")
|
||||||
end
|
end
|
||||||
|
|
||||||
def singlePoolFinished
|
def singlePoolFinished
|
||||||
singlePoolNotFinished
|
singlePoolNotFinished
|
||||||
matches = @matches
|
|
||||||
endMatch(5001,"Jackson Lakso",matches)
|
endMatch(5001,"Jackson Lakso")
|
||||||
end
|
end
|
||||||
|
|
||||||
def sixteenManToSemi
|
def sixteenManToSemi
|
||||||
matches = @matches
|
|
||||||
endMatch(1013,"Guy22",matches)
|
endMatch(1013,"Guy22")
|
||||||
endMatch(1014,"Guy29",matches)
|
endMatch(1014,"Guy29")
|
||||||
endMatch(2012,"Guy29",matches)
|
endMatch(2012,"Guy29")
|
||||||
endMatch(2013,"Guy22",matches)
|
endMatch(2013,"Guy22")
|
||||||
endMatch(3012,"Guy37",matches)
|
endMatch(3012,"Guy37")
|
||||||
endMatch(3013,"Guy22",matches)
|
endMatch(3013,"Guy22")
|
||||||
endMatch(1015,"Guy36",matches)
|
endMatch(1015,"Guy36")
|
||||||
endMatch(1016,"Guy32",matches)
|
endMatch(1016,"Guy32")
|
||||||
endMatch(2014,"Guy36",matches)
|
endMatch(2014,"Guy36")
|
||||||
endMatch(2015,"Guy32",matches)
|
endMatch(2015,"Guy32")
|
||||||
endMatch(3014,"Guy36",matches)
|
endMatch(3014,"Guy36")
|
||||||
endMatch(3015,"Guy23",matches)
|
endMatch(3015,"Guy23")
|
||||||
endMatch(1017,"Guy31",matches)
|
endMatch(1017,"Guy31")
|
||||||
endMatch(1018,"Guy35",matches)
|
endMatch(1018,"Guy35")
|
||||||
endMatch(2016,"Guy35",matches)
|
endMatch(2016,"Guy35")
|
||||||
endMatch(2017,"Guy31",matches)
|
endMatch(2017,"Guy31")
|
||||||
endMatch(3016,"Guy27",matches)
|
endMatch(3016,"Guy27")
|
||||||
endMatch(3017,"Guy31",matches)
|
endMatch(3017,"Guy31")
|
||||||
endMatch(1019,"Guy34",matches)
|
endMatch(1019,"Guy34")
|
||||||
endMatch(1020,"Guy26",matches)
|
endMatch(1020,"Guy26")
|
||||||
endMatch(2018,"Guy30",matches)
|
endMatch(2018,"Guy30")
|
||||||
endMatch(2019,"Guy34",matches)
|
endMatch(2019,"Guy34")
|
||||||
endMatch(3018,"Guy26",matches)
|
endMatch(3018,"Guy26")
|
||||||
endMatch(3019,"Guy34",matches)
|
endMatch(3019,"Guy34")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def sevenManTwoPoolToSemi
|
def sevenManTwoPoolToSemi
|
||||||
matches = @matches
|
|
||||||
endMatch(1006,"Casey Davis",matches)
|
endMatch(1006,"Casey Davis")
|
||||||
endMatch(1007,"Ethan Leapley",matches)
|
endMatch(1007,"Ethan Leapley")
|
||||||
endMatch(2006,"Clayton Ray",matches)
|
endMatch(2006,"Clayton Ray")
|
||||||
endMatch(2007,"Ethan Leapley",matches)
|
endMatch(2007,"Ethan Leapley")
|
||||||
endMatch(3006,"Ethan Leapley",matches)
|
endMatch(3006,"Ethan Leapley")
|
||||||
endMatch(3007,"Casey Davis",matches)
|
endMatch(3007,"Casey Davis")
|
||||||
endMatch(1008,"Kameron Teacher",matches)
|
endMatch(1008,"Kameron Teacher")
|
||||||
endMatch(2008,"Kameron Teacher",matches)
|
endMatch(2008,"Kameron Teacher")
|
||||||
endMatch(3008,"Robbie Fusner",matches)
|
endMatch(3008,"Robbie Fusner")
|
||||||
end
|
end
|
||||||
|
|
||||||
def sevenManTwoPoolSemiToFinals
|
def sevenManTwoPoolSemiToFinals
|
||||||
sevenManTwoPoolToSemi
|
sevenManTwoPoolToSemi
|
||||||
matches = @matches
|
|
||||||
endMatch(4005,"Casey Davis",matches)
|
endMatch(4005,"Casey Davis")
|
||||||
endMatch(4004,"Ethan Leapley",matches)
|
endMatch(4004,"Ethan Leapley")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolOneOutrightWinnerGuyTwo
|
def nineManBracketPoolOneOutrightWinnerGuyTwo
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatch(1002,"Guy8",matches)
|
endMatch(1002,"Guy8")
|
||||||
endMatch(1003,"Guy5",matches)
|
endMatch(1003,"Guy5")
|
||||||
endMatch(2002,"Guy2",matches)
|
endMatch(2002,"Guy2")
|
||||||
endMatch(2003,"Guy8",matches)
|
endMatch(2003,"Guy8")
|
||||||
endMatch(3002,"Guy5",matches)
|
endMatch(3002,"Guy5")
|
||||||
endMatch(3003,"Guy2",matches)
|
endMatch(3003,"Guy2")
|
||||||
endMatch(4002,"Guy8",matches)
|
endMatch(4002,"Guy8")
|
||||||
endMatch(4003,"Guy2",matches)
|
endMatch(4003,"Guy2")
|
||||||
endMatch(5002,"Guy2",matches)
|
endMatch(5002,"Guy2")
|
||||||
endMatch(5003,"Guy10",matches)
|
endMatch(5003,"Guy10")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyNineHeadToHead
|
def nineManBracketPoolTwoGuyNineHeadToHead
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatch(1004,"Guy4",matches)
|
endMatch(1004,"Guy4")
|
||||||
endMatch(1005,"Guy3",matches)
|
endMatch(1005,"Guy3")
|
||||||
endMatch(2004,"Guy9",matches)
|
endMatch(2004,"Guy9")
|
||||||
endMatch(2005,"Guy7",matches)
|
endMatch(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatch(3005,"Guy3",matches)
|
endMatch(3005,"Guy3")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeHeadToHead
|
def nineManBracketPoolTwoGuyThreeHeadToHead
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatch(1004,"Guy9",matches)
|
endMatch(1004,"Guy9")
|
||||||
endMatch(1005,"Guy3",matches)
|
endMatch(1005,"Guy3")
|
||||||
endMatch(2004,"Guy3",matches)
|
endMatch(2004,"Guy3")
|
||||||
endMatch(2005,"Guy7",matches)
|
endMatch(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatch(3005,"Guy4",matches)
|
endMatch(3005,"Guy4")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeDeductedPoints
|
def nineManBracketPoolTwoGuyThreeDeductedPoints
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatch(1004,"Guy9",matches)
|
endMatch(1004,"Guy9")
|
||||||
endMatch(1005,"Guy7",matches)
|
endMatch(1005,"Guy7")
|
||||||
endMatch(2004,"Guy3",matches)
|
endMatch(2004,"Guy3")
|
||||||
endMatch(2005,"Guy7",matches)
|
endMatch(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatch(3005,"Guy3",matches)
|
endMatch(3005,"Guy3")
|
||||||
deduct = Teampointadjust.new
|
deduct = Teampointadjust.new
|
||||||
deduct.wrestler_id = translateNameToId("Guy7")
|
deduct.wrestler_id = translateNameToId("Guy7")
|
||||||
deduct.points = 1
|
deduct.points = 1
|
||||||
@@ -133,175 +131,162 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeMostDecisionPoints
|
def nineManBracketPoolTwoGuyThreeMostDecisionPoints
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatchExtraPoints(1004,"Guy9",matches)
|
endMatchExtraPoints(1004,"Guy9")
|
||||||
endMatch(1005,"Guy7",matches)
|
endMatch(1005,"Guy7")
|
||||||
endMatchExtraPoints(2004,"Guy3",matches)
|
endMatchExtraPoints(2004,"Guy3")
|
||||||
endMatch(2005,"Guy7",matches)
|
endMatch(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatchExtraPoints(3005,"Guy3",matches)
|
endMatchExtraPoints(3005,"Guy3")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeQuickestPin
|
def nineManBracketPoolTwoGuyThreeQuickestPin
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatchWithQuickPin(1004,"Guy9",matches)
|
endMatchWithQuickPin(1004,"Guy9")
|
||||||
endMatchWithPin(1005,"Guy7",matches)
|
endMatchWithPin(1005,"Guy7")
|
||||||
endMatchWithQuickPin(2004,"Guy3",matches)
|
endMatchWithQuickPin(2004,"Guy3")
|
||||||
endMatchWithPin(2005,"Guy7",matches)
|
endMatchWithPin(2005,"Guy7")
|
||||||
endMatchWithPin(3004,"Guy9",matches)
|
endMatchWithPin(3004,"Guy9")
|
||||||
endMatchWithQuickestPin(3005,"Guy3",matches)
|
endMatchWithQuickestPin(3005,"Guy3")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeTeamPoints
|
def nineManBracketPoolTwoGuyThreeTeamPoints
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatch(1004,"Guy9",matches)
|
endMatch(1004,"Guy9")
|
||||||
endMatch(1005,"Guy7",matches)
|
endMatch(1005,"Guy7")
|
||||||
endMatchWithMajor(2004,"Guy3",matches)
|
endMatchWithMajor(2004,"Guy3")
|
||||||
endMatch(2005,"Guy7",matches)
|
endMatch(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatch(3005,"Guy3",matches)
|
endMatch(3005,"Guy3")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolTwoGuyThreeMostPins
|
def nineManBracketPoolTwoGuyThreeMostPins
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatchWithMajor(1004,"Guy9",matches)
|
endMatchWithMajor(1004,"Guy9")
|
||||||
endMatch(1005,"Guy7",matches)
|
endMatch(1005,"Guy7")
|
||||||
endMatchWithPin(2004,"Guy3",matches)
|
endMatchWithPin(2004,"Guy3")
|
||||||
endMatchWithMajor(2005,"Guy7",matches)
|
endMatchWithMajor(2005,"Guy7")
|
||||||
endMatch(3004,"Guy9",matches)
|
endMatch(3004,"Guy9")
|
||||||
endMatch(3005,"Guy3",matches)
|
endMatch(3005,"Guy3")
|
||||||
end
|
end
|
||||||
|
|
||||||
def nineManBracketPoolOneGuyEightMostTechs
|
def nineManBracketPoolOneGuyEightMostTechs
|
||||||
matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"}
|
|
||||||
endMatchWithTech(1002,"Guy8",matches)
|
endMatchWithTech(1002,"Guy8")
|
||||||
endMatch(1003,"Guy5",matches)
|
endMatch(1003,"Guy5")
|
||||||
endMatchWithMajor(2002,"Guy2",matches)
|
endMatchWithMajor(2002,"Guy2")
|
||||||
endMatchWithTech(2003,"Guy8",matches)
|
endMatchWithTech(2003,"Guy8")
|
||||||
endMatchWithMajor(3002,"Guy10",matches)
|
endMatchWithMajor(3002,"Guy10")
|
||||||
endMatchWithMajor(3003,"Guy2",matches)
|
endMatchWithMajor(3003,"Guy2")
|
||||||
endMatch(4002,"Guy8",matches)
|
endMatch(4002,"Guy8")
|
||||||
endMatchWithMajor(4003,"Guy10",matches)
|
endMatchWithMajor(4003,"Guy10")
|
||||||
endMatchWithMajor(5002,"Guy2",matches)
|
endMatchWithMajor(5002,"Guy2")
|
||||||
endMatchWithMajor(5003,"Guy10",matches)
|
endMatchWithMajor(5003,"Guy10")
|
||||||
end
|
end
|
||||||
|
|
||||||
def elevenManBracketToQuarter
|
def elevenManBracketToQuarter
|
||||||
matches = @matches
|
|
||||||
endMatch(1009,"Guy11",matches)
|
endMatch(1009,"Guy11")
|
||||||
endMatch(2009,"Guy11",matches)
|
endMatch(2009,"Guy11")
|
||||||
endMatch(3009,"Guy18",matches)
|
endMatch(3009,"Guy18")
|
||||||
endMatch(1010,"Guy12",matches)
|
endMatch(1010,"Guy12")
|
||||||
endMatch(2010,"Guy12",matches)
|
endMatch(2010,"Guy12")
|
||||||
endMatch(3010,"Guy17",matches)
|
endMatch(3010,"Guy17")
|
||||||
endMatch(1011,"Guy13",matches)
|
endMatch(1011,"Guy13")
|
||||||
endMatch(2011,"Guy13",matches)
|
endMatch(2011,"Guy13")
|
||||||
endMatch(3011,"Guy19",matches)
|
endMatch(3011,"Guy19")
|
||||||
endMatch(1012,"Guy14",matches)
|
endMatch(1012,"Guy14")
|
||||||
end
|
end
|
||||||
def elevenManBracketToSemis
|
def elevenManBracketToSemis
|
||||||
elevenManBracketToQuarter
|
elevenManBracketToQuarter
|
||||||
matches = @matches
|
|
||||||
endMatch(4006,"Guy11",matches)
|
endMatch(4006,"Guy11")
|
||||||
endMatch(4007,"Guy14",matches)
|
endMatch(4007,"Guy14")
|
||||||
endMatch(4008,"Guy12",matches)
|
endMatch(4008,"Guy12")
|
||||||
endMatch(4009,"Guy13",matches)
|
endMatch(4009,"Guy13")
|
||||||
end
|
end
|
||||||
|
|
||||||
def elevenManBracketToFinals
|
def elevenManBracketToFinals
|
||||||
elevenManBracketToSemis
|
elevenManBracketToSemis
|
||||||
matches = @matches
|
|
||||||
endMatch(5004,"Guy11",matches)
|
endMatch(5004,"Guy11")
|
||||||
endMatch(5005,"Guy12",matches)
|
endMatch(5005,"Guy12")
|
||||||
endMatch(5006,"Guy17",matches)
|
endMatch(5006,"Guy17")
|
||||||
endMatch(5007,"Guy18",matches)
|
endMatch(5007,"Guy18")
|
||||||
end
|
end
|
||||||
|
|
||||||
def elevenManBracketFinished
|
def elevenManBracketFinished
|
||||||
elevenManBracketToFinals
|
elevenManBracketToFinals
|
||||||
matches = @matches
|
|
||||||
endMatch(6004,"Guy11",matches)
|
endMatch(6004,"Guy11")
|
||||||
endMatch(6005,"Guy14",matches)
|
endMatch(6005,"Guy14")
|
||||||
endMatch(6006,"Guy17",matches)
|
endMatch(6006,"Guy17")
|
||||||
endMatch(6007,"Guy19",matches)
|
endMatch(6007,"Guy19")
|
||||||
end
|
end
|
||||||
|
|
||||||
def extraDoesNotScoreTeamPoints
|
def extraDoesNotScoreTeamPoints
|
||||||
matches = @matches
|
|
||||||
wrestlerName = "Guy22"
|
wrestlerName = "Guy22"
|
||||||
wrestler = Wrestler.find(translateNameToId(wrestlerName))
|
wrestler = Wrestler.find(translateNameToId(wrestlerName))
|
||||||
wrestler.extra = true
|
wrestler.extra = true
|
||||||
wrestler.save
|
wrestler.save
|
||||||
endMatch(1013,"Guy22",matches)
|
endMatch(1013,"Guy22")
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatch(bout,winner,matches)
|
def endMatch(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
# match = @matches.select{|m| m.bout_number == bout}.first
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Decision"
|
match.win_type = "Decision"
|
||||||
match.score = 1-0
|
match.score = 1-0
|
||||||
|
saveMatch(match,winner)
|
||||||
match.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchExtraPoints(bout,winner,matches)
|
def endMatchExtraPoints(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Decision"
|
match.win_type = "Decision"
|
||||||
match.score = 0-2
|
match.score = 0-2
|
||||||
|
saveMatch(match,winner)
|
||||||
match.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchWithMajor(bout,winner,matches)
|
def endMatchWithMajor(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Major"
|
match.win_type = "Major"
|
||||||
match.score = 8-0
|
match.score = 8-0
|
||||||
|
saveMatch(match,winner)
|
||||||
match.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchWithTech(bout,winner,matches)
|
def endMatchWithTech(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Tech Fall"
|
match.win_type = "Tech Fall"
|
||||||
|
match.score = 15-0
|
||||||
match.save
|
saveMatch(match,winner)
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchWithPin(bout,winner,matches)
|
def endMatchWithPin(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Pin"
|
match.win_type = "Pin"
|
||||||
match.score = "5:00"
|
match.score = "5:00"
|
||||||
|
saveMatch(match,winner)
|
||||||
match.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchWithQuickestPin(bout,winner,matches)
|
def endMatchWithQuickestPin(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Pin"
|
match.win_type = "Pin"
|
||||||
match.score = "0:20"
|
match.score = "0:20"
|
||||||
|
saveMatch(match,winner)
|
||||||
match.save
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def endMatchWithQuickPin(bout,winner,matches)
|
def endMatchWithQuickPin(bout,winner)
|
||||||
match = Match.where(bout_number: bout).first
|
match = Match.where(bout_number: bout).first
|
||||||
match.finished = 1
|
|
||||||
match.winner_id = translateNameToId(winner)
|
|
||||||
match.win_type = "Pin"
|
match.win_type = "Pin"
|
||||||
match.score = "1:20"
|
match.score = "1:20"
|
||||||
|
saveMatch(match,winner)
|
||||||
|
end
|
||||||
|
|
||||||
match.save
|
def saveMatch(match,winner)
|
||||||
|
match.finished = 1
|
||||||
|
match.winner_id = translateNameToId(winner)
|
||||||
|
match.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def translateNameToId(wrestler)
|
def translateNameToId(wrestler)
|
||||||
@@ -458,7 +443,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
test "advancement points winner 1/2" do
|
test "advancement points winner 1/2" do
|
||||||
nineManBracketPoolOneOutrightWinnerGuyTwo
|
nineManBracketPoolOneOutrightWinnerGuyTwo
|
||||||
nineManBracketPoolTwoGuyThreeHeadToHead
|
nineManBracketPoolTwoGuyThreeHeadToHead
|
||||||
endMatch(6000,"Guy2",@matches)
|
endMatch(6000,"Guy2")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
||||||
assert_equal 16, wrestler1.placementPoints
|
assert_equal 16, wrestler1.placementPoints
|
||||||
end
|
end
|
||||||
@@ -466,7 +451,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
test "advancement points winner 3/4" do
|
test "advancement points winner 3/4" do
|
||||||
nineManBracketPoolOneOutrightWinnerGuyTwo
|
nineManBracketPoolOneOutrightWinnerGuyTwo
|
||||||
nineManBracketPoolTwoGuyThreeHeadToHead
|
nineManBracketPoolTwoGuyThreeHeadToHead
|
||||||
endMatch(6001,"Guy8",@matches)
|
endMatch(6001,"Guy8")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy8").first
|
wrestler1 = Wrestler.where("name = ?", "Guy8").first
|
||||||
assert_equal 10, wrestler1.placementPoints
|
assert_equal 10, wrestler1.placementPoints
|
||||||
end
|
end
|
||||||
@@ -486,25 +471,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "bonus points major" do
|
test "bonus points major" do
|
||||||
endMatchWithMajor(2002,"Guy2",@matches)
|
endMatchWithMajor(2002,"Guy2")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
||||||
assert_equal 3, wrestler1.teamPointsEarned
|
assert_equal 3, wrestler1.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
test "bonus points pin" do
|
test "bonus points pin" do
|
||||||
endMatchWithPin(2002,"Guy2",@matches)
|
endMatchWithPin(2002,"Guy2")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
||||||
assert_equal 4, wrestler1.teamPointsEarned
|
assert_equal 4, wrestler1.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
test "bonus points tech fall" do
|
test "bonus points tech fall" do
|
||||||
endMatchWithTech(2002,"Guy2",@matches)
|
endMatchWithTech(2002,"Guy2")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
||||||
assert_equal 3.5, wrestler1.teamPointsEarned
|
assert_equal 3.5, wrestler1.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
test "pool team points win" do
|
test "pool team points win" do
|
||||||
endMatch(2002,"Guy2",@matches)
|
endMatch(2002,"Guy2")
|
||||||
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
wrestler1 = Wrestler.where("name = ?", "Guy2").first
|
||||||
assert_equal 2, wrestler1.teamPointsEarned
|
assert_equal 2, wrestler1.teamPointsEarned
|
||||||
end
|
end
|
||||||
@@ -570,19 +555,19 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
test "Championship bracket wins are 2pts" do
|
test "Championship bracket wins are 2pts" do
|
||||||
elevenManBracketToQuarter
|
elevenManBracketToQuarter
|
||||||
assert_equal 7, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
assert_equal 7, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||||
matches = @matches
|
|
||||||
endMatch(4006,"Guy11",matches)
|
endMatch(4006,"Guy11")
|
||||||
assert_equal 15, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
assert_equal 15, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||||
endMatch(4007,"Guy14",matches)
|
endMatch(4007,"Guy14")
|
||||||
endMatch(5004,"Guy11",matches)
|
endMatch(5004,"Guy11")
|
||||||
assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
test "Conso bracket wins are 1pt" do
|
test "Conso bracket wins are 1pt" do
|
||||||
elevenManBracketToSemis
|
elevenManBracketToSemis
|
||||||
assert_equal 5, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
assert_equal 5, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
||||||
matches = @matches
|
|
||||||
endMatch(5006,"Guy17",matches)
|
endMatch(5006,"Guy17")
|
||||||
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,60 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SingleTestTest < ActionDispatch::IntegrationTest
|
class SingleTestTest < ActionDispatch::IntegrationTest
|
||||||
|
def setup
|
||||||
|
@tournament = Tournament.find(1)
|
||||||
|
# @tournament.generateMatchups
|
||||||
|
# @matches = @tournament.matches
|
||||||
|
end
|
||||||
|
|
||||||
|
#rake test test/integration/single_test_test.rb > matches.txt
|
||||||
|
# Loser names need to be in quotes in yml file
|
||||||
|
def showMatches
|
||||||
|
# matches = Weight.where("id = ?", 4).first.matches
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
# Yml for matches
|
||||||
|
# Match.where(tournament_id: 1).each do |m|
|
||||||
|
# puts "tournament_1_bout_#{m.bout_number}:"
|
||||||
|
# puts " tournament_id: #{m.tournament_id}"
|
||||||
|
# puts " weight_id: #{m.weight_id}"
|
||||||
|
# puts " bout_number: #{m.bout_number}"
|
||||||
|
# puts " w1: #{m.w1}"
|
||||||
|
# puts " w2: #{m.w2}"
|
||||||
|
# puts " bracket_position: #{m.bracket_position}"
|
||||||
|
# puts " bracket_position_number: #{m.bracket_position_number}"
|
||||||
|
# puts " loser1_name: #{m.loser1_name}"
|
||||||
|
# puts " loser2_name: #{m.loser2_name}"
|
||||||
|
# puts " round: #{m.round}"
|
||||||
|
# puts " mat_id: #{m.mat_id}"
|
||||||
|
# puts " finished: #{m.finished}"
|
||||||
|
# puts " w1_stat: "
|
||||||
|
# puts " w2_stat: "
|
||||||
|
# puts " score: "
|
||||||
|
# puts " winner_id: "
|
||||||
|
# puts " win_type: "
|
||||||
|
# puts ""
|
||||||
|
# count += 1
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Yml for wrestlers
|
||||||
|
# @tournament.wrestlers.each do |w|
|
||||||
|
# puts "tournament_1_#{w.name}:"
|
||||||
|
# puts " id: #{count}"
|
||||||
|
# puts " name: #{w.name}"
|
||||||
|
# puts " school_id: #{w.school_id}"
|
||||||
|
# puts " weight_id: #{w.weight_id}"
|
||||||
|
# puts " original_seed: #{w.original_seed}"
|
||||||
|
# puts " season_loss: #{w.season_loss}"
|
||||||
|
# puts " season_win: #{w.season_win}"
|
||||||
|
# puts " criteria: #{w.criteria}"
|
||||||
|
# puts ""
|
||||||
|
# count += 1
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
test "the truth" do
|
test "the truth" do
|
||||||
|
showMatches
|
||||||
assert true
|
assert true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TournamentTest < ActiveSupport::TestCase
|
class TournamentTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
test "the truth" do
|
test "the truth" do
|
||||||
assert true
|
assert true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user