mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-09 23:44:52 +00:00
Fixed bug in single pool placement points and wrote tests
This commit is contained in:
@@ -69,14 +69,15 @@ class PoolBracketPlacementPoints
|
|||||||
def onePool
|
def onePool
|
||||||
poolOrder = @wrestler.weight.poolOrder(1)
|
poolOrder = @wrestler.weight.poolOrder(1)
|
||||||
if @wrestler == poolOrder.first
|
if @wrestler == poolOrder.first
|
||||||
firstPlace
|
return firstPlace
|
||||||
elsif @wrestler == poolOrder.second
|
elsif @wrestler == poolOrder.second
|
||||||
secondPlace
|
return secondPlace
|
||||||
elsif @wrestler == poolOrder.third
|
elsif @wrestler == poolOrder.third
|
||||||
thirdPlace
|
return thirdPlace
|
||||||
elsif @wrestler == poolOrder.fourth
|
elsif @wrestler == poolOrder.fourth
|
||||||
fourthPlace
|
return fourthPlace
|
||||||
end
|
end
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalMatchPoints
|
def finalMatchPoints
|
||||||
|
|||||||
@@ -16,6 +16,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
end
|
end
|
||||||
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)
|
||||||
|
end
|
||||||
|
|
||||||
|
def singlePoolFinished
|
||||||
|
singlePoolNotFinished
|
||||||
|
matches = @matches
|
||||||
|
endMatch(5001,"Jackson Lakso",matches)
|
||||||
|
end
|
||||||
|
|
||||||
def sixteenManToSemi
|
def sixteenManToSemi
|
||||||
matches = @matches
|
matches = @matches
|
||||||
endMatch(1013,"Guy22",matches)
|
endMatch(1013,"Guy22",matches)
|
||||||
@@ -567,4 +586,24 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
|||||||
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "One pool placement points" do
|
||||||
|
singlePoolFinished
|
||||||
|
wrestler1 = Wrestler.where("name = ?", "James Wimer").first
|
||||||
|
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
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SingleTestTest < ActionDispatch::IntegrationTest
|
class SingleTestTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
test "the truth" do
|
test "the truth" do
|
||||||
assert true
|
assert true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user