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

A BYE gives 2 points in a pool of you win one pool match. Now have two tests failing with regard to tie breakers. Most likely poorley written tests

This commit is contained in:
2017-01-18 14:55:11 +00:00
parent aeb6011340
commit e77b555069
3 changed files with 20 additions and 8 deletions

View File

@@ -124,6 +124,14 @@ class Wrestler < ActiveRecord::Base
pool_matches = allMatches.select{|m| m.bracket_position == "Pool"}
pool_matches.select{|m| m.poolNumber == self.generatePoolNumber}
end
def hasAPoolBye
if weight.poolRounds(allMatches) > poolMatches.size
return true
else
return false
end
end
def championshipAdvancementWins
matchesWon.select{|m| m.bracket_position == "Quarter" or m.bracket_position == "Semis"}

View File

@@ -34,7 +34,11 @@ class CalculateWrestlerTeamScore
def poolPoints
if @tournament.tournament_type == "Pool to bracket"
(@wrestler.poolWins.size * 2)
if @wrestler.poolWins.size >= 1 and @wrestler.hasAPoolBye == true
((@wrestler.poolWins.size * 2) + 2)
else
(@wrestler.poolWins.size * 2)
end
else
0
end

View File

@@ -402,7 +402,7 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
wrestler1 = Wrestler.where("name = ?", "Guy2").first
wrestler2 = Wrestler.where("name = ?", "Guy3").first
#Won four in pool
assert_equal 20, wrestler1.totalTeamPoints
assert_equal 22, wrestler1.totalTeamPoints
#Won two in pool
assert_equal 16, wrestler2.totalTeamPoints
end
@@ -466,25 +466,25 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "bonus points major" do
endMatchWithMajor(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 3, wrestler1.teamPointsEarned
assert_equal 5, wrestler1.teamPointsEarned
end
test "bonus points pin" do
endMatchWithPin(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 4, wrestler1.teamPointsEarned
assert_equal 6, wrestler1.teamPointsEarned
end
test "bonus points tech fall" do
endMatchWithTech(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 3.5, wrestler1.teamPointsEarned
assert_equal 5.5, wrestler1.teamPointsEarned
end
test "pool team points win" do
endMatch(2002,"Guy2")
wrestler1 = Wrestler.where("name = ?", "Guy2").first
assert_equal 2, wrestler1.teamPointsEarned
assert_equal 4, wrestler1.teamPointsEarned
end
test "advancement points fourPoolsToQuarter Quarter" do
@@ -558,10 +558,10 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
test "Conso bracket wins are 1pt" do
elevenManBracketToSemis
assert_equal 5, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
assert_equal 7, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
endMatch(5006,"Guy17")
assert_equal 9, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
assert_equal 11, Wrestler.where("name = ?", "Guy17").first.teamPointsEarned
end
test "One pool placement points" do