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:
@@ -126,7 +126,7 @@ class Wrestler < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def hasAPoolBye
|
||||
if weight.poolRounds(allMatches) > poolMatches.size
|
||||
if weight.poolRounds(matches) > poolMatches.size
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
||||
@@ -5,9 +5,9 @@ class CalculateWrestlerTeamScore
|
||||
end
|
||||
|
||||
def totalScore
|
||||
if @wrestler.extra
|
||||
return 0
|
||||
else
|
||||
if @wrestler.extra or @wrestler.matches.count == 0
|
||||
return 0
|
||||
else
|
||||
earnedPoints - deductedPoints
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,17 +67,17 @@ class PoolBracketPlacementPoints
|
||||
end
|
||||
|
||||
def onePool
|
||||
poolOrder = @wrestler.weight.poolOrder(1)
|
||||
if @wrestler == poolOrder.first
|
||||
return firstPlace
|
||||
elsif @wrestler == poolOrder.second
|
||||
return secondPlace
|
||||
elsif @wrestler == poolOrder.third
|
||||
return thirdPlace
|
||||
elsif @wrestler == poolOrder.fourth
|
||||
return fourthPlace
|
||||
end
|
||||
return 0
|
||||
poolOrder = @wrestler.weight.poolOrder(1)
|
||||
if @wrestler == poolOrder.first
|
||||
return firstPlace
|
||||
elsif @wrestler == poolOrder.second
|
||||
return secondPlace
|
||||
elsif @wrestler == poolOrder.third
|
||||
return thirdPlace
|
||||
elsif @wrestler == poolOrder.fourth
|
||||
return fourthPlace
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def finalMatchPoints
|
||||
|
||||
@@ -404,7 +404,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
#Won four in pool
|
||||
assert_equal 22, wrestler1.totalTeamPoints
|
||||
#Won two in pool
|
||||
assert_equal 16, wrestler2.totalTeamPoints
|
||||
assert_equal 18, wrestler2.totalTeamPoints
|
||||
end
|
||||
|
||||
test "advancement points 1/2" do
|
||||
@@ -547,13 +547,13 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "Championship bracket wins are 2pts" do
|
||||
elevenManBracketToQuarter
|
||||
assert_equal 7, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
assert_equal 9, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
|
||||
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(5004,"Guy11")
|
||||
assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
assert_equal 22, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
end
|
||||
|
||||
test "Conso bracket wins are 1pt" do
|
||||
|
||||
Reference in New Issue
Block a user