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
|
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user