mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +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
|
||||
poolOrder = @wrestler.weight.poolOrder(1)
|
||||
if @wrestler == poolOrder.first
|
||||
firstPlace
|
||||
return firstPlace
|
||||
elsif @wrestler == poolOrder.second
|
||||
secondPlace
|
||||
return secondPlace
|
||||
elsif @wrestler == poolOrder.third
|
||||
thirdPlace
|
||||
return thirdPlace
|
||||
elsif @wrestler == poolOrder.fourth
|
||||
fourthPlace
|
||||
return fourthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def finalMatchPoints
|
||||
|
||||
@@ -16,6 +16,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
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
|
||||
matches = @matches
|
||||
endMatch(1013,"Guy22",matches)
|
||||
@@ -567,4 +586,24 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
|
||||
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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class SingleTestTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user