From ddcf2d807e22b5a432de5c57fb83db2b84646cf6 Mon Sep 17 00:00:00 2001 From: jcwimer Date: Sat, 26 Mar 2016 03:54:31 +0000 Subject: [PATCH] Speeding up tests and renaming a few methods in generateMatchups --- Gemfile | 1 + app/models/generates_tournament_matches.rb | 12 +- app/models/match.rb | 4 + app/models/pool.rb | 9 +- app/models/weight.rb | 2 +- test/controllers/matches_controller_test.rb | 6 +- test/controllers/mats_controller_test.rb | 2 +- test/controllers/schools_controller_test.rb | 2 +- .../static_pages_controller_test.rb | 2 +- .../tournaments_controller_test.rb | 2 +- test/controllers/weights_controller_test.rb | 2 +- test/controllers/wrestlers_controller_test.rb | 2 +- test/fixtures/matches.yml | 2035 ++++++++++++++++- test/fixtures/wrestlers.yml | 1010 ++++---- test/integration/pool_advancement_test.rb | 399 ++-- test/integration/single_test_test.rb | 52 + test/models/tournament_test.rb | 1 + 17 files changed, 2814 insertions(+), 729 deletions(-) diff --git a/Gemfile b/Gemfile index 21bcd48..a742ddd 100644 --- a/Gemfile +++ b/Gemfile @@ -60,3 +60,4 @@ gem 'spring', :group => :development #gem 'bullet' end + diff --git a/app/models/generates_tournament_matches.rb b/app/models/generates_tournament_matches.rb index 1e19323..7661a64 100644 --- a/app/models/generates_tournament_matches.rb +++ b/app/models/generates_tournament_matches.rb @@ -8,7 +8,6 @@ module GeneratesTournamentMatches poolToBracket() if tournament_type == "Pool to bracket" self.curently_generating_matches = nil self.save - matches end if Rails.env.production? handle_asynchronously :generateMatchups @@ -16,13 +15,11 @@ module GeneratesTournamentMatches def poolToBracket destroyAllMatches - buildTournamentWeights - generateMatches - # This is not working for pool order and I cannot get tests working - movePoolSeedsToFinalPoolRound + generatePoolToBracketMatches + poolToBracketPostMatchCreation end - def buildTournamentWeights + def generatePoolToBracketMatches weights.order(:max).each do |weight| Pool.new(weight).generatePools() last_match = matches.where(weight: weight).order(round: :desc).limit(1).first @@ -31,11 +28,12 @@ module GeneratesTournamentMatches end end - def generateMatches + def poolToBracketPostMatchCreation moveFinalsMatchesToLastRound assignBouts assignLoserNames assignFirstMatchesToMats + movePoolSeedsToFinalPoolRound end def moveFinalsMatchesToLastRound diff --git a/app/models/match.rb b/app/models/match.rb index 962f993..549bc85 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -7,6 +7,10 @@ class Match < ActiveRecord::Base after_update do + after_update_actions + end + + def after_update_actions if self.finished == 1 && self.winner_id != nil if self.w1 && self.w2 wrestler1.touch diff --git a/app/models/pool.rb b/app/models/pool.rb index f9bdd37..8e7a3af 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -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 diff --git a/app/models/weight.rb b/app/models/weight.rb index 34f7363..824a103 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -14,7 +14,7 @@ class Weight < ActiveRecord::Base end before_save do - self.tournament.destroyAllMatches + # self.tournament.destroyAllMatches end def wrestlersForPool(pool) diff --git a/test/controllers/matches_controller_test.rb b/test/controllers/matches_controller_test.rb index d9bd562..12d6ca0 100644 --- a/test/controllers/matches_controller_test.rb +++ b/test/controllers/matches_controller_test.rb @@ -5,12 +5,12 @@ class MatchesControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups - @match = @tournament.matches.first + # @tournament.generateMatchups + @match = Match.where("tournament_id = ? and mat_id = ?",1,1).first end 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 def get_edit diff --git a/test/controllers/mats_controller_test.rb b/test/controllers/mats_controller_test.rb index 7ebf6c4..38de270 100644 --- a/test/controllers/mats_controller_test.rb +++ b/test/controllers/mats_controller_test.rb @@ -5,7 +5,7 @@ class MatsControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @mat = mats(:one) end diff --git a/test/controllers/schools_controller_test.rb b/test/controllers/schools_controller_test.rb index f788822..eee17d7 100644 --- a/test/controllers/schools_controller_test.rb +++ b/test/controllers/schools_controller_test.rb @@ -5,7 +5,7 @@ class SchoolsControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @school = @tournament.schools.first end diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb index ba2a24b..2eb9388 100644 --- a/test/controllers/static_pages_controller_test.rb +++ b/test/controllers/static_pages_controller_test.rb @@ -5,7 +5,7 @@ class StaticPagesControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @school = @tournament.schools.first end diff --git a/test/controllers/tournaments_controller_test.rb b/test/controllers/tournaments_controller_test.rb index 1e0512b..707c6b3 100644 --- a/test/controllers/tournaments_controller_test.rb +++ b/test/controllers/tournaments_controller_test.rb @@ -5,7 +5,7 @@ include Devise::TestHelpers setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @school = @tournament.schools.first @wrestlers = @tournament.weights.first.wrestlers @adjust = Teampointadjust.find(1) diff --git a/test/controllers/weights_controller_test.rb b/test/controllers/weights_controller_test.rb index ba2a152..f3e7882 100644 --- a/test/controllers/weights_controller_test.rb +++ b/test/controllers/weights_controller_test.rb @@ -5,7 +5,7 @@ class WeightsControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @weight = @tournament.weights.first end diff --git a/test/controllers/wrestlers_controller_test.rb b/test/controllers/wrestlers_controller_test.rb index 9ef496f..2193113 100644 --- a/test/controllers/wrestlers_controller_test.rb +++ b/test/controllers/wrestlers_controller_test.rb @@ -5,7 +5,7 @@ class WrestlersControllerTest < ActionController::TestCase setup do @tournament = Tournament.find(1) - @tournament.generateMatchups + # @tournament.generateMatchups @school = @tournament.schools.first @wrestler = @school.wrestlers.first end diff --git a/test/fixtures/matches.yml b/test/fixtures/matches.yml index ddd43a1..09e08a5 100644 --- a/test/fixtures/matches.yml +++ b/test/fixtures/matches.yml @@ -1,19 +1,2024 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html +# http://chriskottom.com/blog/2014/11/fixing-fixtures/ + # t.integer "w1" + # t.integer "w2" + # t.text "w1_stat" + # t.text "w2_stat" + # t.integer "winner_id" + # t.string "win_type" + # t.string "score" + # t.datetime "created_at" + # t.datetime "updated_at" + # t.integer "tournament_id" + # t.integer "round" + # t.integer "finished" + # t.integer "bout_number" + # t.integer "weight_id" + # t.string "bracket_position" + # t.integer "bracket_position_number" + # t.string "loser1_name" + # t.string "loser2_name" + # t.integer "mat_id" + + +# default: &default +# tournament_id: 1 + # one: -# r_id: 1 -# g_id: 1 -# g_stat: MyText -# r_stat: MyText -# winner_id: 1 -# win_type: MyString -# score: MyString +# <<: *defaults -# two: -# r_id: 1 -# g_id: 1 -# g_stat: MyText -# r_stat: MyText -# winner_id: 1 -# win_type: MyString -# score: MyString +tournament_1_bout_3007: + tournament_id: 1 + weight_id: 2 + bout_number: 3007 + w1: 10 + w2: 7 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6000: + tournament_id: 1 + weight_id: 3 + bout_number: 6000 + w1: + w2: + bracket_position: 1/2 + bracket_position_number: 1 + loser1_name: Winner Pool 1 + loser2_name: Winner Pool 2 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3013: + tournament_id: 1 + weight_id: 5 + bout_number: 3013 + w1: 39 + w2: 35 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4001: + tournament_id: 1 + weight_id: 1 + bout_number: 4001 + w1: 1 + w2: 5 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1002: + tournament_id: 1 + weight_id: 3 + bout_number: 1002 + w1: 18 + w2: 19 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: 1 + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3002: + tournament_id: 1 + weight_id: 3 + bout_number: 3002 + w1: 19 + w2: 21 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2021: + tournament_id: 1 + weight_id: 6 + bout_number: 2021 + w1: 50 + w2: 51 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1007: + tournament_id: 1 + weight_id: 2 + bout_number: 1007 + w1: 11 + w2: 10 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2004: + tournament_id: 1 + weight_id: 3 + bout_number: 2004 + w1: 16 + w2: 14 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1011: + tournament_id: 1 + weight_id: 4 + bout_number: 1011 + w1: 25 + w2: 32 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4004: + tournament_id: 1 + weight_id: 2 + bout_number: 4004 + w1: + w2: + bracket_position: Semis + bracket_position_number: 1 + loser1_name: Winner Pool 1 + loser2_name: Runner Up Pool 2 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4014: + tournament_id: 1 + weight_id: 6 + bout_number: 4014 + w1: 49 + w2: 50 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6002: + tournament_id: 1 + weight_id: 2 + bout_number: 6002 + w1: + w2: + bracket_position: 1/2 + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4007: + tournament_id: 1 + weight_id: 4 + bout_number: 4007 + w1: + w2: + bracket_position: Quarter + bracket_position_number: 2 + loser1_name: Winner Pool 4 + loser2_name: Runner Up Pool 3 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4013: + tournament_id: 1 + weight_id: 5 + bout_number: 4013 + w1: + w2: + bracket_position: Conso Semis + bracket_position_number: 2 + loser1_name: Runner Up Pool 2 + loser2_name: Runner Up Pool 3 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1019: + tournament_id: 1 + weight_id: 5 + bout_number: 1019 + w1: 38 + w2: 48 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2001: + tournament_id: 1 + weight_id: 1 + bout_number: 2001 + w1: 2 + w2: 3 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1017: + tournament_id: 1 + weight_id: 5 + bout_number: 1017 + w1: 34 + w2: 47 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1014: + tournament_id: 1 + weight_id: 5 + bout_number: 1014 + w1: 45 + w2: 39 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6011: + tournament_id: 1 + weight_id: 5 + bout_number: 6011 + w1: + w2: + bracket_position: 7/8 + bracket_position_number: 1 + loser1_name: Loser of 4012 + loser2_name: Loser of 4013 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3018: + tournament_id: 1 + weight_id: 5 + bout_number: 3018 + w1: 40 + w2: 48 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2014: + tournament_id: 1 + weight_id: 5 + bout_number: 2014 + w1: 37 + w2: 33 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6005: + tournament_id: 1 + weight_id: 4 + bout_number: 6005 + w1: + w2: + bracket_position: 3/4 + bracket_position_number: 1 + loser1_name: Loser of 5004 + loser2_name: Loser of 5005 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5002: + tournament_id: 1 + weight_id: 3 + bout_number: 5002 + w1: 21 + w2: 13 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3009: + tournament_id: 1 + weight_id: 4 + bout_number: 3009 + w1: 27 + w2: 30 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5005: + tournament_id: 1 + weight_id: 4 + bout_number: 5005 + w1: + w2: + bracket_position: Semis + bracket_position_number: 2 + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3021: + tournament_id: 1 + weight_id: 6 + bout_number: 3021 + w1: 52 + w2: 50 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2009: + tournament_id: 1 + weight_id: 4 + bout_number: 2009 + w1: 30 + w2: 28 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3011: + tournament_id: 1 + weight_id: 4 + bout_number: 3011 + w1: 32 + w2: 24 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6001: + tournament_id: 1 + weight_id: 3 + bout_number: 6001 + w1: + w2: + bracket_position: 3/4 + bracket_position_number: 1 + loser1_name: Runner Up Pool 1 + loser2_name: Runner Up Pool 2 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6008: + tournament_id: 1 + weight_id: 5 + bout_number: 6008 + w1: + w2: + bracket_position: 1/2 + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3017: + tournament_id: 1 + weight_id: 5 + bout_number: 3017 + w1: 41 + w2: 34 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4000: + tournament_id: 1 + weight_id: 1 + bout_number: 4000 + w1: 4 + w2: 2 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3015: + tournament_id: 1 + weight_id: 5 + bout_number: 3015 + w1: 37 + w2: 44 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2012: + tournament_id: 1 + weight_id: 5 + bout_number: 2012 + w1: 39 + w2: 46 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2000: + tournament_id: 1 + weight_id: 1 + bout_number: 2000 + w1: 5 + w2: 4 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1021: + tournament_id: 1 + weight_id: 6 + bout_number: 1021 + w1: 50 + w2: 53 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2019: + tournament_id: 1 + weight_id: 5 + bout_number: 2019 + w1: 38 + w2: 40 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1016: + tournament_id: 1 + weight_id: 5 + bout_number: 1016 + w1: 36 + w2: 37 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6006: + tournament_id: 1 + weight_id: 4 + bout_number: 6006 + w1: + w2: + bracket_position: 5/6 + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5009: + tournament_id: 1 + weight_id: 6 + bout_number: 5009 + w1: 49 + w2: 53 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3010: + tournament_id: 1 + weight_id: 4 + bout_number: 3010 + w1: 22 + w2: 31 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4008: + tournament_id: 1 + weight_id: 4 + bout_number: 4008 + w1: + w2: + bracket_position: Quarter + bracket_position_number: 3 + loser1_name: Winner Pool 2 + loser2_name: Runner Up Pool 1 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3008: + tournament_id: 1 + weight_id: 2 + bout_number: 3008 + w1: 6 + w2: 9 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2005: + tournament_id: 1 + weight_id: 3 + bout_number: 2005 + w1: 17 + w2: 15 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1003: + tournament_id: 1 + weight_id: 3 + bout_number: 1003 + w1: 21 + w2: 20 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: 1 + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2017: + tournament_id: 1 + weight_id: 5 + bout_number: 2017 + w1: 34 + w2: 43 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4011: + tournament_id: 1 + weight_id: 5 + bout_number: 4011 + w1: + w2: + bracket_position: Semis + bracket_position_number: 2 + loser1_name: Winner Pool 2 + loser2_name: Winner Pool 3 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3003: + tournament_id: 1 + weight_id: 3 + bout_number: 3003 + w1: 13 + w2: 18 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5006: + tournament_id: 1 + weight_id: 4 + bout_number: 5006 + w1: + w2: + bracket_position: Conso Semis + bracket_position_number: 1 + loser1_name: Loser of 4006 + loser2_name: Loser of 4007 + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3006: + tournament_id: 1 + weight_id: 2 + bout_number: 3006 + w1: 11 + w2: 12 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5003: + tournament_id: 1 + weight_id: 3 + bout_number: 5003 + w1: 20 + w2: 19 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5008: + tournament_id: 1 + weight_id: 6 + bout_number: 5008 + w1: 51 + w2: 52 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2010: + tournament_id: 1 + weight_id: 4 + bout_number: 2010 + w1: 31 + w2: 23 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4009: + tournament_id: 1 + weight_id: 4 + bout_number: 4009 + w1: + w2: + bracket_position: Quarter + bracket_position_number: 4 + loser1_name: Winner Pool 3 + loser2_name: Runner Up Pool 4 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1001: + tournament_id: 1 + weight_id: 1 + bout_number: 1001 + w1: 3 + w2: 4 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: 1 + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1022: + tournament_id: 1 + weight_id: 6 + bout_number: 1022 + w1: 51 + w2: 49 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2018: + tournament_id: 1 + weight_id: 5 + bout_number: 2018 + w1: 42 + w2: 48 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1015: + tournament_id: 1 + weight_id: 5 + bout_number: 1015 + w1: 44 + w2: 33 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6007: + tournament_id: 1 + weight_id: 4 + bout_number: 6007 + w1: + w2: + bracket_position: 7/8 + bracket_position_number: 1 + loser1_name: Loser of 5006 + loser2_name: Loser of 5007 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6009: + tournament_id: 1 + weight_id: 5 + bout_number: 6009 + w1: + w2: + bracket_position: 3/4 + bracket_position_number: 1 + loser1_name: Loser of 4010 + loser2_name: Loser of 4011 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3016: + tournament_id: 1 + weight_id: 5 + bout_number: 3016 + w1: 43 + w2: 47 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3001: + tournament_id: 1 + weight_id: 1 + bout_number: 3001 + w1: 5 + w2: 2 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3014: + tournament_id: 1 + weight_id: 5 + bout_number: 3014 + w1: 36 + w2: 33 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2013: + tournament_id: 1 + weight_id: 5 + bout_number: 2013 + w1: 35 + w2: 45 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1006: + tournament_id: 1 + weight_id: 2 + bout_number: 1006 + w1: 7 + w2: 12 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3020: + tournament_id: 1 + weight_id: 6 + bout_number: 3020 + w1: 53 + w2: 51 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1009: + tournament_id: 1 + weight_id: 4 + bout_number: 1009 + w1: 28 + w2: 27 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1012: + tournament_id: 1 + weight_id: 4 + bout_number: 1012 + w1: 26 + w2: 29 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2007: + tournament_id: 1 + weight_id: 2 + bout_number: 2007 + w1: 7 + w2: 11 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1004: + tournament_id: 1 + weight_id: 3 + bout_number: 1004 + w1: 17 + w2: 14 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5007: + tournament_id: 1 + weight_id: 4 + bout_number: 5007 + w1: + w2: + bracket_position: Conso Semis + bracket_position_number: 2 + loser1_name: Loser of 4008 + loser2_name: Loser of 4009 + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4002: + tournament_id: 1 + weight_id: 3 + bout_number: 4002 + w1: 20 + w2: 18 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4010: + tournament_id: 1 + weight_id: 5 + bout_number: 4010 + w1: + w2: + bracket_position: Semis + bracket_position_number: 1 + loser1_name: Winner Pool 1 + loser2_name: Winner Pool 4 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2016: + tournament_id: 1 + weight_id: 5 + bout_number: 2016 + w1: 41 + w2: 47 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2002: + tournament_id: 1 + weight_id: 3 + bout_number: 2002 + w1: 13 + w2: 20 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2008: + tournament_id: 1 + weight_id: 2 + bout_number: 2008 + w1: 9 + w2: 8 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3004: + tournament_id: 1 + weight_id: 3 + bout_number: 3004 + w1: 15 + w2: 14 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2011: + tournament_id: 1 + weight_id: 4 + bout_number: 2011 + w1: 24 + w2: 25 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2006: + tournament_id: 1 + weight_id: 2 + bout_number: 2006 + w1: 10 + w2: 12 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1005: + tournament_id: 1 + weight_id: 3 + bout_number: 1005 + w1: 15 + w2: 16 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2020: + tournament_id: 1 + weight_id: 6 + bout_number: 2020 + w1: 52 + w2: 49 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2003: + tournament_id: 1 + weight_id: 3 + bout_number: 2003 + w1: 18 + w2: 21 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5001: + tournament_id: 1 + weight_id: 1 + bout_number: 5001 + w1: 4 + w2: 1 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3012: + tournament_id: 1 + weight_id: 5 + bout_number: 3012 + w1: 45 + w2: 46 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5000: + tournament_id: 1 + weight_id: 1 + bout_number: 5000 + w1: 3 + w2: 5 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1008: + tournament_id: 1 + weight_id: 2 + bout_number: 1008 + w1: 8 + w2: 6 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3005: + tournament_id: 1 + weight_id: 3 + bout_number: 3005 + w1: 16 + w2: 17 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1010: + tournament_id: 1 + weight_id: 4 + bout_number: 1010 + w1: 23 + w2: 22 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_5004: + tournament_id: 1 + weight_id: 4 + bout_number: 5004 + w1: + w2: + bracket_position: Semis + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 5 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4003: + tournament_id: 1 + weight_id: 3 + bout_number: 4003 + w1: 19 + w2: 13 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1000: + tournament_id: 1 + weight_id: 1 + bout_number: 1000 + w1: 2 + w2: 1 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: 1 + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6010: + tournament_id: 1 + weight_id: 5 + bout_number: 6010 + w1: + w2: + bracket_position: 5/6 + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3019: + tournament_id: 1 + weight_id: 5 + bout_number: 3019 + w1: 42 + w2: 38 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_2015: + tournament_id: 1 + weight_id: 5 + bout_number: 2015 + w1: 44 + w2: 36 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 2 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6004: + tournament_id: 1 + weight_id: 4 + bout_number: 6004 + w1: + w2: + bracket_position: 1/2 + bracket_position_number: 1 + loser1_name: + loser2_name: + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4012: + tournament_id: 1 + weight_id: 5 + bout_number: 4012 + w1: + w2: + bracket_position: Conso Semis + bracket_position_number: 1 + loser1_name: Runner Up Pool 1 + loser2_name: Runner Up Pool 4 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1020: + tournament_id: 1 + weight_id: 5 + bout_number: 1020 + w1: 40 + w2: 42 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_3000: + tournament_id: 1 + weight_id: 1 + bout_number: 3000 + w1: 1 + w2: 3 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 3 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1018: + tournament_id: 1 + weight_id: 5 + bout_number: 1018 + w1: 43 + w2: 41 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_1013: + tournament_id: 1 + weight_id: 5 + bout_number: 1013 + w1: 35 + w2: 46 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 1 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4015: + tournament_id: 1 + weight_id: 6 + bout_number: 4015 + w1: 53 + w2: 52 + bracket_position: Pool + bracket_position_number: + loser1_name: + loser2_name: + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_6003: + tournament_id: 1 + weight_id: 2 + bout_number: 6003 + w1: + w2: + bracket_position: 3/4 + bracket_position_number: 1 + loser1_name: Loser of 4004 + loser2_name: Loser of 4005 + round: 6 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4006: + tournament_id: 1 + weight_id: 4 + bout_number: 4006 + w1: + w2: + bracket_position: Quarter + bracket_position_number: 1 + loser1_name: Winner Pool 1 + loser2_name: Runner Up Pool 2 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: + +tournament_1_bout_4005: + tournament_id: 1 + weight_id: 2 + bout_number: 4005 + w1: + w2: + bracket_position: Semis + bracket_position_number: 2 + loser1_name: Winner Pool 2 + loser2_name: Runner Up Pool 1 + round: 4 + mat_id: + finished: + w1_stat: + w2_stat: + score: + winner_id: + win_type: diff --git a/test/fixtures/wrestlers.yml b/test/fixtures/wrestlers.yml index e07dd47..d2f48af 100644 --- a/test/fixtures/wrestlers.yml +++ b/test/fixtures/wrestlers.yml @@ -1,487 +1,531 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - name: Zach Collins - school_id: 1 - weight_id: 1 - original_seed: 4 - season_loss: 8 - season_win: 30 - criteria: DP 5th - -two: - name: Jaden Mattox - school_id: 1 - weight_id: 1 - original_seed: 1 - season_loss: 3 - season_win: 49 - criteria: SP 2nd - -three: - name: Jackson Lakso - school_id: 1 - weight_id: 1 - original_seed: 3 - season_loss: 8 - season_win: 30 - criteria: SQ - -four: - name: JD Woods - school_id: 1 - weight_id: 1 - original_seed: 5 - season_loss: 12 - season_win: 30 - criteria: DP 6th - -five: - name: James Wimer - school_id: 1 - weight_id: 1 - original_seed: 2 - season_loss: 12 - season_win: 49 - criteria: SP 5th - -six: - name: Derek Wurzauf - school_id: 1 - weight_id: 2 - original_seed: 6 - season_loss: 15 - season_win: 16 - criteria: - -seven: - name: Casey Davis - school_id: 1 - weight_id: 2 - original_seed: 5 - season_loss: 15 - season_win: 16 - criteria: DQ - -eight: - name: Ethan Leapley - school_id: 1 - weight_id: 2 - original_seed: 4 - season_loss: 15 - season_win: 20 - criteria: DP 6th - -nine: - name: Clayton Ray - school_id: 1 - weight_id: 2 - original_seed: 1 - season_loss: 4 - season_win: 30 - criteria: SP 7th - -ten: - name: Robbie Fusner - school_id: 1 - weight_id: 2 - original_seed: 3 - season_loss: 5 - season_win: 40 - criteria: SQ - -eleven: - name: Kameron Teacher - school_id: 1 - weight_id: 2 - original_seed: 2 - season_loss: 2 - season_win: 50 - criteria: SQ - -twelve: - name: Guy1 - school_id: 1 - weight_id: 2 - original_seed: 7 - season_loss: 2 - season_win: 50 - criteria: - -thirteen: - name: Guy2 - school_id: 1 - weight_id: 3 - original_seed: 1 - season_loss: 2 - season_win: 50 - criteria: - -fourteen: - name: Guy3 - school_id: 1 - weight_id: 3 - original_seed: 2 - season_loss: 2 - season_win: 50 - criteria: - -fifteen: - name: Guy4 - school_id: 1 - weight_id: 3 - original_seed: 3 - season_loss: 2 - season_win: 50 - criteria: - -sixteen: - name: Guy5 - school_id: 1 - weight_id: 3 - original_seed: 4 - season_loss: 2 - season_win: 50 - criteria: - -seventeen: - name: Guy6 - school_id: 1 - weight_id: 3 - original_seed: 5 - season_loss: 2 - season_win: 50 - criteria: - -eighteen: - name: Guy7 - school_id: 1 - weight_id: 3 - original_seed: 6 - season_loss: 2 - season_win: 50 - criteria: - -ninteen: - name: Guy8 - school_id: 1 - weight_id: 3 - original_seed: 7 - season_loss: 2 - season_win: 50 - criteria: - -twenty: - name: Guy9 - school_id: 1 - weight_id: 3 - original_seed: 8 - season_loss: 2 - season_win: 50 - criteria: - -twentyone: - name: Guy10 - school_id: 1 - weight_id: 3 - original_seed: 9 - season_loss: 2 - season_win: 50 - criteria: +wrestler1: + id: 1 + name: Jackson Lakso + school_id: 1 + weight_id: 1 + original_seed: 3 + season_loss: 8 + season_win: 30 + criteria: SQ -twentytwo: - name: Guy11 - school_id: 1 - weight_id: 4 - original_seed: 1 - season_loss: 2 - season_win: 50 - criteria: - -twentythree: - name: Guy12 - school_id: 1 - weight_id: 4 - original_seed: 2 - season_loss: 2 - season_win: 50 - criteria: - -twentyfour: - name: Guy13 - school_id: 1 - weight_id: 4 - original_seed: 3 - season_loss: 2 - season_win: 50 - criteria: - -twentyfive: - name: Guy14 - school_id: 1 - weight_id: 4 - original_seed: 4 - season_loss: 2 - season_win: 50 - criteria: - -twentysix: - name: Guy15 - school_id: 1 - weight_id: 4 - original_seed: 5 - season_loss: 2 - season_win: 50 - criteria: - -twnetyseven: - name: Guy16 - school_id: 1 - weight_id: 4 - original_seed: 6 - season_loss: 2 - season_win: 50 - criteria: - -twentyeight: - name: Guy17 - school_id: 1 - weight_id: 4 - original_seed: 7 - season_loss: 2 - season_win: 50 - criteria: - -twentynine: - name: Guy18 - school_id: 1 - weight_id: 4 - original_seed: 8 - season_loss: 2 - season_win: 50 - criteria: - -thirty: - name: Guy19 - school_id: 1 - weight_id: 4 - original_seed: 9 - season_loss: 2 - season_win: 50 - criteria: - -thrityone: - name: Guy20 - school_id: 1 - weight_id: 4 - original_seed: 10 - season_loss: 2 - season_win: 50 - criteria: - -thirtytwo: - name: Guy21 - school_id: 1 - weight_id: 4 - original_seed: 11 - season_loss: 2 - season_win: 50 - criteria: - -thirtythree: - name: Guy22 - school_id: 1 - weight_id: 5 - original_seed: 1 - season_loss: 2 - season_win: 50 - criteria: - -thirtyfour: - name: Guy23 - school_id: 1 - weight_id: 5 - original_seed: 2 - season_loss: 2 - season_win: 50 - criteria: - -thirtyfive: - name: Guy24 - school_id: 1 - weight_id: 5 - original_seed: 3 - season_loss: 2 - season_win: 50 - criteria: - -thirtysix: - name: Guy25 - school_id: 1 - weight_id: 5 - original_seed: 4 - season_loss: 2 - season_win: 50 - criteria: - -thirtyseven: - name: Guy26 - school_id: 1 - weight_id: 5 - original_seed: 5 - season_loss: 2 - season_win: 50 - criteria: - -thirtyeight: - name: Guy27 - school_id: 1 - weight_id: 5 - original_seed: 6 - season_loss: 2 - season_win: 50 - criteria: - -thirtynine: - name: Guy28 - school_id: 1 - weight_id: 5 - original_seed: 7 - season_loss: 2 - season_win: 50 - criteria: - -fourty: - name: Guy29 - school_id: 1 - weight_id: 5 - original_seed: 8 - season_loss: 2 - season_win: 50 - criteria: - -fourtyone: - name: Guy30 - school_id: 1 - weight_id: 5 - original_seed: 9 - season_loss: 2 - season_win: 50 - criteria: - -fourtytwo: - name: Guy31 - school_id: 1 - weight_id: 5 - original_seed: 10 - season_loss: 2 - season_win: 50 - criteria: - -fourtythree: - name: Guy32 - school_id: 1 - weight_id: 5 - original_seed: 11 - season_loss: 2 - season_win: 50 - criteria: +wrestler2: + id: 2 + name: JD Woods + school_id: 1 + weight_id: 1 + original_seed: 5 + season_loss: 12 + season_win: 30 + criteria: DP 6th -fourtyfour: - name: Guy33 - school_id: 1 - weight_id: 5 - original_seed: 12 - season_loss: 2 - season_win: 50 - criteria: - -fourtyfive: - name: Guy34 - school_id: 1 - weight_id: 5 - original_seed: 13 - season_loss: 2 - season_win: 50 - criteria: - -fourtysix: - name: Guy35 - school_id: 1 - weight_id: 5 - original_seed: 14 - season_loss: 2 - season_win: 50 - criteria: - -fourtyseven: - name: Guy36 - school_id: 1 - weight_id: 5 - original_seed: 15 - season_loss: 2 - season_win: 50 - criteria: - -fourtyeight: - name: Guy37 - school_id: 1 - weight_id: 5 - original_seed: 16 - season_loss: 2 - season_win: 50 - criteria: - -fourtynine: - name: Guy38 - school_id: 1 - weight_id: 6 - original_seed: 1 - season_loss: 2 - season_win: 50 - criteria: - -fourtynine: - name: Guy39 - school_id: 1 - weight_id: 6 - original_seed: 2 - season_loss: 2 - season_win: 50 - criteria: - -fifty: - name: Guy40 - school_id: 1 - weight_id: 6 - original_seed: - season_loss: 2 - season_win: 50 - criteria: - -fiftyone: - name: Guy41 - school_id: 1 - weight_id: 6 - original_seed: - season_loss: 2 - season_win: 50 - criteria: - -fiftytwo: - name: Guy42 - school_id: 1 - weight_id: 6 - original_seed: - season_loss: 2 - season_win: 50 - criteria: - -fiftythree: - name: Guy43 - school_id: 1 - weight_id: 6 - original_seed: - season_loss: 2 - season_win: 50 - criteria: \ No newline at end of file +wrestler3: + id: 3 + name: Jaden Mattox + school_id: 1 + weight_id: 1 + original_seed: 1 + season_loss: 3 + season_win: 49 + criteria: SP 2nd + +wrestler4: + id: 4 + name: Zach Collins + school_id: 1 + weight_id: 1 + original_seed: 4 + season_loss: 8 + season_win: 30 + criteria: DP 5th + +wrestler5: + id: 5 + name: James Wimer + school_id: 1 + weight_id: 1 + original_seed: 2 + season_loss: 12 + season_win: 49 + criteria: SP 5th + +wrestler6: + id: 6 + name: Derek Wurzauf + school_id: 1 + weight_id: 2 + original_seed: 6 + season_loss: 15 + season_win: 16 + criteria: + +wrestler7: + id: 7 + name: Casey Davis + school_id: 1 + weight_id: 2 + original_seed: 5 + season_loss: 15 + season_win: 16 + criteria: DQ + +wrestler8: + id: 8 + name: Kameron Teacher + school_id: 1 + weight_id: 2 + original_seed: 2 + season_loss: 2 + season_win: 50 + criteria: SQ + +wrestler9: + id: 9 + name: Robbie Fusner + school_id: 1 + weight_id: 2 + original_seed: 3 + season_loss: 5 + season_win: 40 + criteria: SQ + +wrestler10: + id: 10 + name: Guy1 + school_id: 1 + weight_id: 2 + original_seed: 7 + season_loss: 2 + season_win: 50 + criteria: + +wrestler11: + id: 11 + name: Ethan Leapley + school_id: 1 + weight_id: 2 + original_seed: 4 + season_loss: 15 + season_win: 20 + criteria: DP 6th + +wrestler12: + id: 12 + name: Clayton Ray + school_id: 1 + weight_id: 2 + original_seed: 1 + season_loss: 4 + season_win: 30 + criteria: SP 7th + +wrestler13: + id: 13 + name: Guy2 + school_id: 1 + weight_id: 3 + original_seed: 1 + season_loss: 2 + season_win: 50 + criteria: + +wrestler14: + id: 14 + name: Guy9 + school_id: 1 + weight_id: 3 + original_seed: 8 + season_loss: 2 + season_win: 50 + criteria: + +wrestler15: + id: 15 + name: Guy7 + school_id: 1 + weight_id: 3 + original_seed: 6 + season_loss: 2 + season_win: 50 + criteria: + +wrestler16: + id: 16 + name: Guy3 + school_id: 1 + weight_id: 3 + original_seed: 2 + season_loss: 2 + season_win: 50 + criteria: + +wrestler17: + id: 17 + name: Guy4 + school_id: 1 + weight_id: 3 + original_seed: 3 + season_loss: 2 + season_win: 50 + criteria: + +wrestler18: + id: 18 + name: Guy8 + school_id: 1 + weight_id: 3 + original_seed: 7 + season_loss: 2 + season_win: 50 + criteria: + +wrestler19: + id: 19 + name: Guy10 + school_id: 1 + weight_id: 3 + original_seed: 9 + season_loss: 2 + season_win: 50 + criteria: + +wrestler20: + id: 20 + name: Guy6 + school_id: 1 + weight_id: 3 + original_seed: 5 + season_loss: 2 + season_win: 50 + criteria: + +wrestler21: + id: 21 + name: Guy5 + school_id: 1 + weight_id: 3 + original_seed: 4 + season_loss: 2 + season_win: 50 + criteria: + +wrestler22: + id: 22 + name: Guy20 + school_id: 1 + weight_id: 4 + original_seed: 10 + season_loss: 2 + season_win: 50 + criteria: + +wrestler23: + id: 23 + name: Guy12 + school_id: 1 + weight_id: 4 + original_seed: 2 + season_loss: 2 + season_win: 50 + criteria: + +wrestler24: + id: 24 + name: Guy16 + school_id: 1 + weight_id: 4 + original_seed: 6 + season_loss: 2 + season_win: 50 + criteria: + +wrestler25: + id: 25 + name: Guy13 + school_id: 1 + weight_id: 4 + original_seed: 3 + season_loss: 2 + season_win: 50 + criteria: + +wrestler26: + id: 26 + name: Guy15 + school_id: 1 + weight_id: 4 + original_seed: 5 + season_loss: 2 + season_win: 50 + criteria: + +wrestler27: + id: 27 + name: Guy21 + school_id: 1 + weight_id: 4 + original_seed: 11 + season_loss: 2 + season_win: 50 + criteria: + +wrestler28: + id: 28 + name: Guy11 + school_id: 1 + weight_id: 4 + original_seed: 1 + season_loss: 2 + season_win: 50 + criteria: + +wrestler29: + id: 29 + name: Guy14 + school_id: 1 + weight_id: 4 + original_seed: 4 + season_loss: 2 + season_win: 50 + criteria: + +wrestler30: + id: 30 + name: Guy18 + school_id: 1 + weight_id: 4 + original_seed: 8 + season_loss: 2 + season_win: 50 + criteria: + +wrestler31: + id: 31 + name: Guy17 + school_id: 1 + weight_id: 4 + original_seed: 7 + season_loss: 2 + season_win: 50 + criteria: + +wrestler32: + id: 32 + name: Guy19 + school_id: 1 + weight_id: 4 + original_seed: 9 + season_loss: 2 + season_win: 50 + criteria: + +wrestler33: + id: 33 + name: Guy36 + school_id: 1 + weight_id: 5 + original_seed: 15 + season_loss: 2 + season_win: 50 + criteria: + +wrestler34: + id: 34 + name: Guy31 + school_id: 1 + weight_id: 5 + original_seed: 10 + season_loss: 2 + season_win: 50 + criteria: + +wrestler35: + id: 35 + name: Guy22 + school_id: 1 + weight_id: 5 + original_seed: 1 + season_loss: 2 + season_win: 50 + criteria: + +wrestler36: + id: 36 + name: Guy32 + school_id: 1 + weight_id: 5 + original_seed: 11 + season_loss: 2 + season_win: 50 + criteria: + +wrestler37: + id: 37 + name: Guy23 + school_id: 1 + weight_id: 5 + original_seed: 2 + season_loss: 2 + season_win: 50 + criteria: + +wrestler38: + id: 38 + name: Guy34 + school_id: 1 + weight_id: 5 + original_seed: 13 + season_loss: 2 + season_win: 50 + criteria: + +wrestler39: + id: 39 + name: Guy29 + school_id: 1 + weight_id: 5 + original_seed: 8 + season_loss: 2 + season_win: 50 + criteria: + +wrestler40: + id: 40 + name: Guy26 + school_id: 1 + weight_id: 5 + original_seed: 5 + season_loss: 2 + season_win: 50 + criteria: + +wrestler41: + id: 41 + name: Guy35 + school_id: 1 + weight_id: 5 + original_seed: 14 + season_loss: 2 + season_win: 50 + criteria: + +wrestler42: + id: 42 + name: Guy30 + school_id: 1 + weight_id: 5 + original_seed: 9 + season_loss: 2 + season_win: 50 + criteria: + +wrestler43: + id: 43 + name: Guy27 + school_id: 1 + weight_id: 5 + original_seed: 6 + season_loss: 2 + season_win: 50 + criteria: + +wrestler44: + id: 44 + name: Guy28 + school_id: 1 + weight_id: 5 + original_seed: 7 + season_loss: 2 + season_win: 50 + criteria: + +wrestler45: + id: 45 + name: Guy37 + school_id: 1 + weight_id: 5 + original_seed: 16 + season_loss: 2 + season_win: 50 + criteria: + +wrestler46: + id: 46 + name: Guy33 + school_id: 1 + weight_id: 5 + original_seed: 12 + season_loss: 2 + season_win: 50 + criteria: + +wrestler47: + id: 47 + name: Guy24 + school_id: 1 + weight_id: 5 + original_seed: 3 + season_loss: 2 + season_win: 50 + criteria: + +wrestler48: + id: 48 + name: Guy25 + school_id: 1 + weight_id: 5 + original_seed: 4 + season_loss: 2 + season_win: 50 + criteria: + +wrestler49: + id: 49 + name: Guy42 + school_id: 1 + weight_id: 6 + original_seed: + season_loss: 2 + season_win: 50 + criteria: + +wrestler50: + id: 50 + name: Guy39 + school_id: 1 + weight_id: 6 + original_seed: 2 + season_loss: 2 + season_win: 50 + criteria: + +wrestler51: + id: 51 + name: Guy41 + school_id: 1 + weight_id: 6 + original_seed: + season_loss: 2 + season_win: 50 + criteria: + +wrestler52: + id: 52 + name: Guy43 + school_id: 1 + weight_id: 6 + original_seed: + season_loss: 2 + season_win: 50 + criteria: + +wrestler53: + id: 53 + name: Guy40 + school_id: 1 + weight_id: 6 + original_seed: + season_loss: 2 + season_win: 50 + criteria: \ No newline at end of file diff --git a/test/integration/pool_advancement_test.rb b/test/integration/pool_advancement_test.rb index 14c526c..3b033ac 100644 --- a/test/integration/pool_advancement_test.rb +++ b/test/integration/pool_advancement_test.rb @@ -3,129 +3,127 @@ require 'test_helper' class PoolAdvancementTest < ActionDispatch::IntegrationTest def setup - @tournament = Tournament.find(1) - @tournament.generateMatchups - @matches = @tournament.matches + tournament = Tournament.find(1) + tournament.generateMatchups end - def showMatches - matches = Weight.where("id = ?", 4).first.matches - # matches = @matches.select{|m| m.weight_id == 4} - matches.each do |m| - puts "Bout: #{m.bout_number} #{m.w1_name} vs #{m.w2_name} #{m.bracket_position} #{m.poolNumber}" - end - end + # def showMatches + # matches = Weight.where("id = ?", 4).first.matches + # matches.each do |m| + # puts "Bout: #{m.bout_number} #{m.w1_name} vs #{m.w2_name} #{m.bracket_position} #{m.poolNumber}" + # end + # end def singlePoolNotFinished - matches = @matches - endMatch(1000,"Jackson Lakso",matches) - endMatch(1001,"Jaden Mattox",matches) - endMatch(2000,"James Wimer",matches) - endMatch(2001,"Jaden Mattox",matches) - endMatch(3000,"Jaden Mattox",matches) - endMatch(3001,"James Wimer",matches) - endMatch(4000,"JD Woods",matches) - endMatch(4001,"James Wimer",matches) - endMatch(5000,"James Wimer",matches) + + endMatch(1000,"Jackson Lakso") + endMatch(1001,"Jaden Mattox") + endMatch(2000,"James Wimer") + endMatch(2001,"Jaden Mattox") + endMatch(3000,"Jaden Mattox") + endMatch(3001,"James Wimer") + endMatch(4000,"JD Woods") + endMatch(4001,"James Wimer") + endMatch(5000,"James Wimer") end def singlePoolFinished singlePoolNotFinished - matches = @matches - endMatch(5001,"Jackson Lakso",matches) + + endMatch(5001,"Jackson Lakso") end def sixteenManToSemi - matches = @matches - endMatch(1013,"Guy22",matches) - endMatch(1014,"Guy29",matches) - endMatch(2012,"Guy29",matches) - endMatch(2013,"Guy22",matches) - endMatch(3012,"Guy37",matches) - endMatch(3013,"Guy22",matches) - endMatch(1015,"Guy36",matches) - endMatch(1016,"Guy32",matches) - endMatch(2014,"Guy36",matches) - endMatch(2015,"Guy32",matches) - endMatch(3014,"Guy36",matches) - endMatch(3015,"Guy23",matches) - endMatch(1017,"Guy31",matches) - endMatch(1018,"Guy35",matches) - endMatch(2016,"Guy35",matches) - endMatch(2017,"Guy31",matches) - endMatch(3016,"Guy27",matches) - endMatch(3017,"Guy31",matches) - endMatch(1019,"Guy34",matches) - endMatch(1020,"Guy26",matches) - endMatch(2018,"Guy30",matches) - endMatch(2019,"Guy34",matches) - endMatch(3018,"Guy26",matches) - endMatch(3019,"Guy34",matches) + + endMatch(1013,"Guy22") + endMatch(1014,"Guy29") + endMatch(2012,"Guy29") + endMatch(2013,"Guy22") + endMatch(3012,"Guy37") + endMatch(3013,"Guy22") + endMatch(1015,"Guy36") + endMatch(1016,"Guy32") + endMatch(2014,"Guy36") + endMatch(2015,"Guy32") + endMatch(3014,"Guy36") + endMatch(3015,"Guy23") + endMatch(1017,"Guy31") + endMatch(1018,"Guy35") + endMatch(2016,"Guy35") + endMatch(2017,"Guy31") + endMatch(3016,"Guy27") + endMatch(3017,"Guy31") + endMatch(1019,"Guy34") + endMatch(1020,"Guy26") + endMatch(2018,"Guy30") + endMatch(2019,"Guy34") + endMatch(3018,"Guy26") + endMatch(3019,"Guy34") end def sevenManTwoPoolToSemi - matches = @matches - endMatch(1006,"Casey Davis",matches) - endMatch(1007,"Ethan Leapley",matches) - endMatch(2006,"Clayton Ray",matches) - endMatch(2007,"Ethan Leapley",matches) - endMatch(3006,"Ethan Leapley",matches) - endMatch(3007,"Casey Davis",matches) - endMatch(1008,"Kameron Teacher",matches) - endMatch(2008,"Kameron Teacher",matches) - endMatch(3008,"Robbie Fusner",matches) + + endMatch(1006,"Casey Davis") + endMatch(1007,"Ethan Leapley") + endMatch(2006,"Clayton Ray") + endMatch(2007,"Ethan Leapley") + endMatch(3006,"Ethan Leapley") + endMatch(3007,"Casey Davis") + endMatch(1008,"Kameron Teacher") + endMatch(2008,"Kameron Teacher") + endMatch(3008,"Robbie Fusner") end def sevenManTwoPoolSemiToFinals sevenManTwoPoolToSemi - matches = @matches - endMatch(4005,"Casey Davis",matches) - endMatch(4004,"Ethan Leapley",matches) + + endMatch(4005,"Casey Davis") + endMatch(4004,"Ethan Leapley") end def nineManBracketPoolOneOutrightWinnerGuyTwo - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatch(1002,"Guy8",matches) - endMatch(1003,"Guy5",matches) - endMatch(2002,"Guy2",matches) - endMatch(2003,"Guy8",matches) - endMatch(3002,"Guy5",matches) - endMatch(3003,"Guy2",matches) - endMatch(4002,"Guy8",matches) - endMatch(4003,"Guy2",matches) - endMatch(5002,"Guy2",matches) - endMatch(5003,"Guy10",matches) + + endMatch(1002,"Guy8") + endMatch(1003,"Guy5") + endMatch(2002,"Guy2") + endMatch(2003,"Guy8") + endMatch(3002,"Guy5") + endMatch(3003,"Guy2") + endMatch(4002,"Guy8") + endMatch(4003,"Guy2") + endMatch(5002,"Guy2") + endMatch(5003,"Guy10") end def nineManBracketPoolTwoGuyNineHeadToHead - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatch(1004,"Guy4",matches) - endMatch(1005,"Guy3",matches) - endMatch(2004,"Guy9",matches) - endMatch(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatch(3005,"Guy3",matches) + + endMatch(1004,"Guy4") + endMatch(1005,"Guy3") + endMatch(2004,"Guy9") + endMatch(2005,"Guy7") + endMatch(3004,"Guy9") + endMatch(3005,"Guy3") end def nineManBracketPoolTwoGuyThreeHeadToHead - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatch(1004,"Guy9",matches) - endMatch(1005,"Guy3",matches) - endMatch(2004,"Guy3",matches) - endMatch(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatch(3005,"Guy4",matches) + + endMatch(1004,"Guy9") + endMatch(1005,"Guy3") + endMatch(2004,"Guy3") + endMatch(2005,"Guy7") + endMatch(3004,"Guy9") + endMatch(3005,"Guy4") end def nineManBracketPoolTwoGuyThreeDeductedPoints - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatch(1004,"Guy9",matches) - endMatch(1005,"Guy7",matches) - endMatch(2004,"Guy3",matches) - endMatch(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatch(3005,"Guy3",matches) + + endMatch(1004,"Guy9") + endMatch(1005,"Guy7") + endMatch(2004,"Guy3") + endMatch(2005,"Guy7") + endMatch(3004,"Guy9") + endMatch(3005,"Guy3") deduct = Teampointadjust.new deduct.wrestler_id = translateNameToId("Guy7") deduct.points = 1 @@ -133,175 +131,162 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest end def nineManBracketPoolTwoGuyThreeMostDecisionPoints - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatchExtraPoints(1004,"Guy9",matches) - endMatch(1005,"Guy7",matches) - endMatchExtraPoints(2004,"Guy3",matches) - endMatch(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatchExtraPoints(3005,"Guy3",matches) + + endMatchExtraPoints(1004,"Guy9") + endMatch(1005,"Guy7") + endMatchExtraPoints(2004,"Guy3") + endMatch(2005,"Guy7") + endMatch(3004,"Guy9") + endMatchExtraPoints(3005,"Guy3") end def nineManBracketPoolTwoGuyThreeQuickestPin - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatchWithQuickPin(1004,"Guy9",matches) - endMatchWithPin(1005,"Guy7",matches) - endMatchWithQuickPin(2004,"Guy3",matches) - endMatchWithPin(2005,"Guy7",matches) - endMatchWithPin(3004,"Guy9",matches) - endMatchWithQuickestPin(3005,"Guy3",matches) + + endMatchWithQuickPin(1004,"Guy9") + endMatchWithPin(1005,"Guy7") + endMatchWithQuickPin(2004,"Guy3") + endMatchWithPin(2005,"Guy7") + endMatchWithPin(3004,"Guy9") + endMatchWithQuickestPin(3005,"Guy3") end def nineManBracketPoolTwoGuyThreeTeamPoints - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatch(1004,"Guy9",matches) - endMatch(1005,"Guy7",matches) - endMatchWithMajor(2004,"Guy3",matches) - endMatch(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatch(3005,"Guy3",matches) + + endMatch(1004,"Guy9") + endMatch(1005,"Guy7") + endMatchWithMajor(2004,"Guy3") + endMatch(2005,"Guy7") + endMatch(3004,"Guy9") + endMatch(3005,"Guy3") end def nineManBracketPoolTwoGuyThreeMostPins - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatchWithMajor(1004,"Guy9",matches) - endMatch(1005,"Guy7",matches) - endMatchWithPin(2004,"Guy3",matches) - endMatchWithMajor(2005,"Guy7",matches) - endMatch(3004,"Guy9",matches) - endMatch(3005,"Guy3",matches) + + endMatchWithMajor(1004,"Guy9") + endMatch(1005,"Guy7") + endMatchWithPin(2004,"Guy3") + endMatchWithMajor(2005,"Guy7") + endMatch(3004,"Guy9") + endMatch(3005,"Guy3") end def nineManBracketPoolOneGuyEightMostTechs - matches = @matches.select{|m| m.weight_id == 3 && m.bracket_position == "Pool"} - endMatchWithTech(1002,"Guy8",matches) - endMatch(1003,"Guy5",matches) - endMatchWithMajor(2002,"Guy2",matches) - endMatchWithTech(2003,"Guy8",matches) - endMatchWithMajor(3002,"Guy10",matches) - endMatchWithMajor(3003,"Guy2",matches) - endMatch(4002,"Guy8",matches) - endMatchWithMajor(4003,"Guy10",matches) - endMatchWithMajor(5002,"Guy2",matches) - endMatchWithMajor(5003,"Guy10",matches) + + endMatchWithTech(1002,"Guy8") + endMatch(1003,"Guy5") + endMatchWithMajor(2002,"Guy2") + endMatchWithTech(2003,"Guy8") + endMatchWithMajor(3002,"Guy10") + endMatchWithMajor(3003,"Guy2") + endMatch(4002,"Guy8") + endMatchWithMajor(4003,"Guy10") + endMatchWithMajor(5002,"Guy2") + endMatchWithMajor(5003,"Guy10") end def elevenManBracketToQuarter - matches = @matches - endMatch(1009,"Guy11",matches) - endMatch(2009,"Guy11",matches) - endMatch(3009,"Guy18",matches) - endMatch(1010,"Guy12",matches) - endMatch(2010,"Guy12",matches) - endMatch(3010,"Guy17",matches) - endMatch(1011,"Guy13",matches) - endMatch(2011,"Guy13",matches) - endMatch(3011,"Guy19",matches) - endMatch(1012,"Guy14",matches) + + endMatch(1009,"Guy11") + endMatch(2009,"Guy11") + endMatch(3009,"Guy18") + endMatch(1010,"Guy12") + endMatch(2010,"Guy12") + endMatch(3010,"Guy17") + endMatch(1011,"Guy13") + endMatch(2011,"Guy13") + endMatch(3011,"Guy19") + endMatch(1012,"Guy14") end def elevenManBracketToSemis elevenManBracketToQuarter - matches = @matches - endMatch(4006,"Guy11",matches) - endMatch(4007,"Guy14",matches) - endMatch(4008,"Guy12",matches) - endMatch(4009,"Guy13",matches) + + endMatch(4006,"Guy11") + endMatch(4007,"Guy14") + endMatch(4008,"Guy12") + endMatch(4009,"Guy13") end def elevenManBracketToFinals elevenManBracketToSemis - matches = @matches - endMatch(5004,"Guy11",matches) - endMatch(5005,"Guy12",matches) - endMatch(5006,"Guy17",matches) - endMatch(5007,"Guy18",matches) + + endMatch(5004,"Guy11") + endMatch(5005,"Guy12") + endMatch(5006,"Guy17") + endMatch(5007,"Guy18") end def elevenManBracketFinished elevenManBracketToFinals - matches = @matches - endMatch(6004,"Guy11",matches) - endMatch(6005,"Guy14",matches) - endMatch(6006,"Guy17",matches) - endMatch(6007,"Guy19",matches) + + endMatch(6004,"Guy11") + endMatch(6005,"Guy14") + endMatch(6006,"Guy17") + endMatch(6007,"Guy19") end def extraDoesNotScoreTeamPoints - matches = @matches + wrestlerName = "Guy22" wrestler = Wrestler.find(translateNameToId(wrestlerName)) wrestler.extra = true wrestler.save - endMatch(1013,"Guy22",matches) + endMatch(1013,"Guy22") end - def endMatch(bout,winner,matches) - match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) + def endMatch(bout,winner) + match = Match.where(bout_number: bout).first + # match = @matches.select{|m| m.bout_number == bout}.first match.win_type = "Decision" match.score = 1-0 - - match.save + saveMatch(match,winner) end - def endMatchExtraPoints(bout,winner,matches) + def endMatchExtraPoints(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Decision" match.score = 0-2 - - match.save + saveMatch(match,winner) end - def endMatchWithMajor(bout,winner,matches) + def endMatchWithMajor(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Major" match.score = 8-0 - - match.save + saveMatch(match,winner) end - def endMatchWithTech(bout,winner,matches) + def endMatchWithTech(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Tech Fall" - - match.save + match.score = 15-0 + saveMatch(match,winner) end - def endMatchWithPin(bout,winner,matches) + def endMatchWithPin(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Pin" match.score = "5:00" - - match.save + saveMatch(match,winner) end - def endMatchWithQuickestPin(bout,winner,matches) + def endMatchWithQuickestPin(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Pin" match.score = "0:20" - - match.save + saveMatch(match,winner) end - def endMatchWithQuickPin(bout,winner,matches) + def endMatchWithQuickPin(bout,winner) match = Match.where(bout_number: bout).first - match.finished = 1 - match.winner_id = translateNameToId(winner) match.win_type = "Pin" match.score = "1:20" - - match.save + saveMatch(match,winner) + end + + def saveMatch(match,winner) + match.finished = 1 + match.winner_id = translateNameToId(winner) + match.save end def translateNameToId(wrestler) @@ -458,7 +443,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest test "advancement points winner 1/2" do nineManBracketPoolOneOutrightWinnerGuyTwo nineManBracketPoolTwoGuyThreeHeadToHead - endMatch(6000,"Guy2",@matches) + endMatch(6000,"Guy2") wrestler1 = Wrestler.where("name = ?", "Guy2").first assert_equal 16, wrestler1.placementPoints end @@ -466,7 +451,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest test "advancement points winner 3/4" do nineManBracketPoolOneOutrightWinnerGuyTwo nineManBracketPoolTwoGuyThreeHeadToHead - endMatch(6001,"Guy8",@matches) + endMatch(6001,"Guy8") wrestler1 = Wrestler.where("name = ?", "Guy8").first assert_equal 10, wrestler1.placementPoints end @@ -486,25 +471,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest end test "bonus points major" do - endMatchWithMajor(2002,"Guy2",@matches) + endMatchWithMajor(2002,"Guy2") wrestler1 = Wrestler.where("name = ?", "Guy2").first assert_equal 3, wrestler1.teamPointsEarned end test "bonus points pin" do - endMatchWithPin(2002,"Guy2",@matches) + endMatchWithPin(2002,"Guy2") wrestler1 = Wrestler.where("name = ?", "Guy2").first assert_equal 4, wrestler1.teamPointsEarned end test "bonus points tech fall" do - endMatchWithTech(2002,"Guy2",@matches) + endMatchWithTech(2002,"Guy2") wrestler1 = Wrestler.where("name = ?", "Guy2").first assert_equal 3.5, wrestler1.teamPointsEarned end test "pool team points win" do - endMatch(2002,"Guy2",@matches) + endMatch(2002,"Guy2") wrestler1 = Wrestler.where("name = ?", "Guy2").first assert_equal 2, wrestler1.teamPointsEarned end @@ -570,19 +555,19 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest test "Championship bracket wins are 2pts" do elevenManBracketToQuarter 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 - endMatch(4007,"Guy14",matches) - endMatch(5004,"Guy11",matches) + endMatch(4007,"Guy14") + endMatch(5004,"Guy11") assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned end test "Conso bracket wins are 1pt" do elevenManBracketToSemis 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 end diff --git a/test/integration/single_test_test.rb b/test/integration/single_test_test.rb index 75b7ea5..3a3159e 100644 --- a/test/integration/single_test_test.rb +++ b/test/integration/single_test_test.rb @@ -1,8 +1,60 @@ require 'test_helper' 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 + showMatches assert true end end diff --git a/test/models/tournament_test.rb b/test/models/tournament_test.rb index 2eb7ae9..ae89d0f 100644 --- a/test/models/tournament_test.rb +++ b/test/models/tournament_test.rb @@ -1,6 +1,7 @@ require 'test_helper' class TournamentTest < ActiveSupport::TestCase + test "the truth" do assert true end