1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Refactored names of methods and some db column

This commit is contained in:
2018-11-13 14:14:48 +00:00
parent 93be525832
commit d67a8f2b42
44 changed files with 350 additions and 350 deletions

View File

@@ -289,49 +289,49 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "nine man outright finals advance" do
nineManBracketPoolOneOutrightWinnerGuyTwo
wrestler = Wrestler.where("name = ?", "Guy2").first
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man outright conso finals advance" do
nineManBracketPoolOneOutrightWinnerGuyTwo
wrestler = Wrestler.where("name = ?", "Guy8").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 2 man to man tie breaker finalist guy 9" do
wrestler = Wrestler.where("name = ?", "Guy9").first
nineManBracketPoolTwoGuyNineHeadToHead
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man pool 2 man to man tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeHeadToHead
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals man to man tie breaker guy 3" do
nineManBracketPoolTwoGuyNineHeadToHead
wrestler = Wrestler.where("name = ?", "Guy3").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man conso finals man to man tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeHeadToHead
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 2 deductedPoints tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeDeductedPoints
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals deductedPoints tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeDeductedPoints
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
@@ -339,61 +339,61 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "nine man pool 2 mostDecisionPointsScored tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeMostDecisionPoints
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals mostDecisionPointsScored tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeMostDecisionPoints
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 2 QuickestPin tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeQuickestPin
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals QuickestPin tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeQuickestPin
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 2 teamPoints tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeTeamPoints
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals teamPoints tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeTeamPoints
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 2 mostPins tie breaker finalist guy 3" do
wrestler = Wrestler.where("name = ?", "Guy3").first
nineManBracketPoolTwoGuyThreeMostPins
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals mostPins tie breaker guy 9" do
nineManBracketPoolTwoGuyThreeMostPins
wrestler = Wrestler.where("name = ?", "Guy9").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "nine man pool 1 mostTechs tie breaker finalist guy 8" do
nineManBracketPoolOneGuyEightMostTechs
wrestler = Wrestler.where("name = ?", "Guy8").first
assert_equal 6000, wrestler.boutByRound(6)
assert_equal 6000, wrestler.bout_by_round(6)
end
test "nine man conso finals mostTechs tie breaker guy 10" do
nineManBracketPoolOneGuyEightMostTechs
wrestler = Wrestler.where("name = ?", "Guy10").first
assert_equal 6001, wrestler.boutByRound(6)
assert_equal 6001, wrestler.bout_by_round(6)
end
test "twoPoolsToFinal total points finals" do
@@ -402,35 +402,35 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
wrestler1 = Wrestler.where("name = ?", "Guy2").first
wrestler2 = Wrestler.where("name = ?", "Guy3").first
#Won four in pool
assert_equal 22, wrestler1.totalTeamPoints
assert_equal 22, wrestler1.total_team_points
#Won two in pool
assert_equal 18, wrestler2.totalTeamPoints
assert_equal 18, wrestler2.total_team_points
end
test "advancement points 1/2" do
nineManBracketPoolOneOutrightWinnerGuyTwo
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 12, wrestler1.placementPoints
assert_equal 12, wrestler1.placement_points
end
test "advancement points 3/4" do
nineManBracketPoolOneOutrightWinnerGuyTwo
wrestler1 = Wrestler.where("name = ?", "Guy8").first
assert_equal 9, wrestler1.placementPoints
assert_equal 9, wrestler1.placement_points
end
test "advancement points 5/6" do
elevenManBracketToFinals
wrestler = Wrestler.where("name = ?", "Guy17").first
assert_equal 6, wrestler.placementPoints
assert_equal 6, wrestler.placement_points
end
test "advancement points 7/8" do
elevenManBracketToFinals
wrestler = Wrestler.where("name = ?", "Guy19").first
assert_equal 3, wrestler.placementPoints
assert_equal 3, wrestler.placement_points
end
test "advancement points winner 1/2" do
@@ -438,7 +438,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
nineManBracketPoolTwoGuyThreeHeadToHead
endMatch(6000,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 16, wrestler1.placementPoints
assert_equal 16, wrestler1.placement_points
end
test "advancement points winner 3/4" do
@@ -446,91 +446,91 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
nineManBracketPoolTwoGuyThreeHeadToHead
endMatch(6001,"Guy8")
wrestler1 = Wrestler.where("name = ?", "Guy8").first
assert_equal 10, wrestler1.placementPoints
assert_equal 10, wrestler1.placement_points
end
test "advancement points winner 5/6" do
elevenManBracketFinished
wrestler = Wrestler.where("name = ?", "Guy17").first
assert_equal 7, wrestler.placementPoints
assert_equal 7, wrestler.placement_points
end
test "advancement points winner 7/8" do
elevenManBracketFinished
wrestler = Wrestler.where("name = ?", "Guy19").first
assert_equal 4, wrestler.placementPoints
assert_equal 4, wrestler.placement_points
end
test "bonus points major" do
endMatchWithMajor(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 5, wrestler1.teamPointsEarned
assert_equal 5, wrestler1.team_points_earned
end
test "bonus points pin" do
endMatchWithPin(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 6, wrestler1.teamPointsEarned
assert_equal 6, wrestler1.team_points_earned
end
test "bonus points tech fall" do
endMatchWithTech(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 5.5, wrestler1.teamPointsEarned
assert_equal 5.5, wrestler1.team_points_earned
end
test "pool team points win" do
endMatch(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 4, wrestler1.teamPointsEarned
assert_equal 4, wrestler1.team_points_earned
end
test "advancement points fourPoolsToQuarter Quarter" do
elevenManBracketToQuarter
wrestler1 = Wrestler.where("name = ?", "Guy11").first
assert_equal 3, wrestler1.placementPoints
assert_equal 3, wrestler1.placement_points
end
test "advancement points fourPoolsToQuarter Semis" do
elevenManBracketToSemis
wrestler = Wrestler.where("name = ?", "Guy11").first
assert_equal 9, wrestler.placementPoints
assert_equal 9, wrestler.placement_points
end
test "advancement points twoPoolsToSemi Semis" do
sevenManTwoPoolToSemi
wrestler = Wrestler.where("name = ?", "Casey Davis").first
assert_equal 9, wrestler.placementPoints
assert_equal 9, wrestler.placement_points
end
test "advancement points twoPoolsToSemi Finals" do
sevenManTwoPoolSemiToFinals
wrestler = Wrestler.where("name = ?", "Casey Davis").first
assert_equal 12, wrestler.placementPoints
assert_equal 12, wrestler.placement_points
end
test "advancement points fourPoolsToSemi Semis and Conso Semis" do
sixteenManToSemi
wrestler = Wrestler.where("name = ?", "Guy22").first
assert_equal 9, wrestler.placementPoints
assert_equal 9, wrestler.placement_points
wrestler = Wrestler.where("name = ?", "Guy29").first
assert_equal 3, wrestler.placementPoints
assert_equal 3, wrestler.placement_points
end
test "extra does not score points but does get pool criteria" do
extraDoesNotScoreTeamPoints
wrestler = Wrestler.where("name = ?", "Guy22").first
assert_equal 0, wrestler.totalTeamPoints
assert_equal 2, wrestler.teamPointsEarned
assert_equal 0, wrestler.total_team_points
assert_equal 2, wrestler.team_points_earned
end
test "Test mat assignment when adding a mat and when destroying a mat" do
@@ -547,21 +547,21 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "Championship bracket wins are 2pts" do
elevenManBracketToQuarter
assert_equal 9, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
assert_equal 9, Wrestler.where("name = ?", "Guy11").first.team_points_earned
endMatch(4006,"Guy11")
assert_equal 17, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
assert_equal 17, Wrestler.where("name = ?", "Guy11").first.team_points_earned
endMatch(4007,"Guy14")
endMatch(5004,"Guy11")
assert_equal 22, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
assert_equal 22, Wrestler.where("name = ?", "Guy11").first.team_points_earned
end
test "Conso bracket wins are 1pt" do
elevenManBracketToSemis
assert_equal 7, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
assert_equal 7, Wrestler.where("name = ?", "Guy17").first.team_points_earned
endMatch(5006,"Guy17")
assert_equal 11, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
assert_equal 11, Wrestler.where("name = ?", "Guy17").first.team_points_earned
end
test "One pool placement points" do
@@ -570,16 +570,16 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
wrestler2 = Wrestler.where("name = ?", "Jaden Mattox").first
wrestler3 = Wrestler.where("name = ?", "Jackson Lakso").first
wrestler4 = Wrestler.where("name = ?", "JD Woods").first
assert_equal 16, wrestler1.placementPoints
assert_equal 12, wrestler2.placementPoints
assert_equal 10, wrestler3.placementPoints
assert_equal 9, wrestler4.placementPoints
assert_equal 16, wrestler1.placement_points
assert_equal 12, wrestler2.placement_points
assert_equal 10, wrestler3.placement_points
assert_equal 9, wrestler4.placement_points
end
test "One pool placement points zero if pool not finished" do
singlePoolNotFinished
wrestler1 = Wrestler.where("name = ?", "James Wimer").first
assert_equal 0, wrestler1.placementPoints
assert_equal 0, wrestler1.placement_points
end

View File

@@ -74,9 +74,9 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
tournament.weights.each do |w|
w.wrestlers.each do |wr|
round = 1
if w.totalRounds(matchups) > 5
until round > w.poolRounds(matchups) do
if wr.boutByRound(round) == "BYE"
if w.total_rounds(matchups) > 5
until round > w.pool_rounds(matchups) do
if wr.bout_by_round(round) == "BYE"
message = "BYE"
end
round += 1
@@ -94,7 +94,7 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
test "tournament can be set to high school weight classes" do
@tournament.weights.destroy_all
@tournament.createCustomWeights("hs")
@tournament.create_pre_defined_weights("hs")
assert_equal Weight::HS_WEIGHT_CLASSES.size, @tournament.weights.size
end
@@ -251,7 +251,7 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
end
test "finals matches in last round" do
lastRound = @tournament.totalRounds
lastRound = @tournament.total_rounds
finalsMatches = @tournament.matches.select{|m| m.bracket_position == "1/2" || m.bracket_position == "3/4" || m.bracket_position == "5/6" || m.bracket_position == "7/8"}
finalsMatches.each do |m|
assert_equal lastRound, m.round

View File

@@ -11,17 +11,17 @@ class SwapWrestlersTest < ActionDispatch::IntegrationTest
wrestler2 = wrestlers(:swap_wrestlers_wrestler_2)
wrestler3 = wrestlers(:swap_wrestlers_wrestler_3)
wrestler4 = wrestlers(:swap_wrestlers_wrestler_4)
SwapWrestlers.new.swapWrestlers(wrestler1.id,wrestler2.id)
SwapWrestlers.new.swap_wrestlers_bracket_lines(wrestler1.id,wrestler2.id)
#Variable needs refreshed otherwise asserts fail
wrestler1 = Wrestler.find(54)
wrestler2 = Wrestler.find(55)
assert_not_empty wrestler1.matchAgainst(wrestler3)
assert_not_empty wrestler1.match_against(wrestler3)
assert_equal 2, wrestler1.pool
assert_equal 2, wrestler1.bracket_line
assert_not_empty wrestler2.matchAgainst(wrestler4)
assert_not_empty wrestler2.match_against(wrestler4)
assert_equal 1, wrestler2.pool
assert_equal 1, wrestler2.bracket_line
end