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

Fixed glitch in pool byes receiving 2 points when you have at least 1 pool

win. Poolrounds was not returning what I was expecting.
This commit is contained in:
2017-01-19 00:41:34 -05:00
parent e77b555069
commit 96dc5407da
4 changed files with 19 additions and 19 deletions

View File

@@ -126,7 +126,7 @@ class Wrestler < ActiveRecord::Base
end end
def hasAPoolBye def hasAPoolBye
if weight.poolRounds(allMatches) > poolMatches.size if weight.poolRounds(matches) > poolMatches.size
return true return true
else else
return false return false

View File

@@ -5,9 +5,9 @@ class CalculateWrestlerTeamScore
end end
def totalScore def totalScore
if @wrestler.extra if @wrestler.extra or @wrestler.matches.count == 0
return 0 return 0
else else
earnedPoints - deductedPoints earnedPoints - deductedPoints
end end
end end

View File

@@ -67,17 +67,17 @@ class PoolBracketPlacementPoints
end end
def onePool def onePool
poolOrder = @wrestler.weight.poolOrder(1) poolOrder = @wrestler.weight.poolOrder(1)
if @wrestler == poolOrder.first if @wrestler == poolOrder.first
return firstPlace return firstPlace
elsif @wrestler == poolOrder.second elsif @wrestler == poolOrder.second
return secondPlace return secondPlace
elsif @wrestler == poolOrder.third elsif @wrestler == poolOrder.third
return thirdPlace return thirdPlace
elsif @wrestler == poolOrder.fourth elsif @wrestler == poolOrder.fourth
return fourthPlace return fourthPlace
end end
return 0 return 0
end end
def finalMatchPoints def finalMatchPoints

View File

@@ -404,7 +404,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
#Won four in pool #Won four in pool
assert_equal 22, wrestler1.totalTeamPoints assert_equal 22, wrestler1.totalTeamPoints
#Won two in pool #Won two in pool
assert_equal 16, wrestler2.totalTeamPoints assert_equal 18, wrestler2.totalTeamPoints
end end
test "advancement points 1/2" do test "advancement points 1/2" do
@@ -547,13 +547,13 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "Championship bracket wins are 2pts" do test "Championship bracket wins are 2pts" do
elevenManBracketToQuarter elevenManBracketToQuarter
assert_equal 7, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned assert_equal 9, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
endMatch(4006,"Guy11") endMatch(4006,"Guy11")
assert_equal 15, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned assert_equal 17, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
endMatch(4007,"Guy14") endMatch(4007,"Guy14")
endMatch(5004,"Guy11") endMatch(5004,"Guy11")
assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned assert_equal 22, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
end end
test "Conso bracket wins are 1pt" do test "Conso bracket wins are 1pt" do