diff --git a/app/models/pool_bracket_placement_points.rb b/app/models/pool_bracket_placement_points.rb index 5cb381c..4cf5713 100644 --- a/app/models/pool_bracket_placement_points.rb +++ b/app/models/pool_bracket_placement_points.rb @@ -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 diff --git a/test/integration/pool_advancement_test.rb b/test/integration/pool_advancement_test.rb index 3446ab1..14c526c 100644 --- a/test/integration/pool_advancement_test.rb +++ b/test/integration/pool_advancement_test.rb @@ -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 diff --git a/test/integration/single_test_test.rb b/test/integration/single_test_test.rb index d7d07a9..75b7ea5 100644 --- a/test/integration/single_test_test.rb +++ b/test/integration/single_test_test.rb @@ -1,6 +1,7 @@ require 'test_helper' class SingleTestTest < ActionDispatch::IntegrationTest + test "the truth" do assert true end