mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-31 11:35:45 +00:00
Championship bracket wins are 2pts and conso bracket wins are 1pt
This commit is contained in:
@@ -27,7 +27,7 @@ class Wrestler < ActiveRecord::Base
|
||||
|
||||
def teamPointsEarned
|
||||
points = 0.0
|
||||
points = points + (poolWins.size * 2) + (pinWins.size * 2) + (techWins.size * 1.5) + (majorWins.size * 1) + placementPoints
|
||||
points = points + (poolWins.size * 2) + (championshipAdvancementWins.size * 2) + (consoAdvancementWins.size * 1) + (pinWins.size * 2) + (techWins.size * 1.5) + (majorWins.size * 1) + placementPoints
|
||||
end
|
||||
|
||||
def placementPoints
|
||||
@@ -131,6 +131,14 @@ class Wrestler < ActiveRecord::Base
|
||||
@poolMatches.select{|m| m.poolNumber == self.generatePoolNumber}
|
||||
end
|
||||
|
||||
def championshipAdvancementWins
|
||||
finishedBracketMatches.select{|m| m.bracket_position == "Quarter" or m.bracket_position == "Semis"}
|
||||
end
|
||||
|
||||
def consoAdvancementWins
|
||||
finishedBracketMatches.select{|m| m.bracket_position == "Conso Semis"}
|
||||
end
|
||||
|
||||
def finishedMatches
|
||||
allMatches.select{|m| m.finished == 1}
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
<p>For pool to bracket tournaments, team points will be calculated as follows:</p>
|
||||
<ul>
|
||||
<li>Pool win: 2pt</li>
|
||||
<li>Win in championship bracket: 2pt</li>
|
||||
<li>Win in consolation bracket: 1pt</li>
|
||||
<li>Win by major: 1pt extra</li>
|
||||
<li>Win by tech fall: 1.5pt extra</li>
|
||||
<li>Win by fall, default, dq: 2pt extra</li>
|
||||
@@ -33,7 +35,7 @@
|
||||
<li>7th place: 4pt</li>
|
||||
<li>8th place: 3pt</li>
|
||||
</ul>
|
||||
<p>Wins outside of the pool will only get bonus points (for maj tech or fall) and extra placement points. Please note, only brackets with four pools place up to 8. Brackets with 1 or 2 pools only place top 4.</p>
|
||||
<p>Finals matches will only recieve extra placement points for placing higher and bonus points for pin, tech, major, etc. Please note, only brackets with four pools place up to 8. Brackets with 1 or 2 pools only place top 4.</p>
|
||||
<br>
|
||||
<h4>Future Plans</h4>
|
||||
<br>
|
||||
|
||||
@@ -548,4 +548,23 @@ class PoolAdvancementTest < ActionDispatch::IntegrationTest
|
||||
assert_equal 4, @mat1.matches.size
|
||||
end
|
||||
|
||||
test "Championship bracket wins are 2pts" do
|
||||
elevenManBracketToQuarter
|
||||
assert_equal 7, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
matches = @matches
|
||||
endMatch(4006,"Guy11",matches)
|
||||
assert_equal 15, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
endMatch(4007,"Guy14",matches)
|
||||
endMatch(5004,"Guy11",matches)
|
||||
assert_equal 20, Wrestler.where("name = ?", "Guy11").first.teamPointsEarned
|
||||
end
|
||||
|
||||
test "Conso bracket wins are 1pt" do
|
||||
elevenManBracketToSemis
|
||||
assert_equal 7, Wrestler.where("name = ?", "Guy16").first.teamPointsEarned
|
||||
matches = @matches
|
||||
endMatch(5006,"Guy16",matches)
|
||||
assert_equal 11, Wrestler.where("name = ?", "Guy16").first.teamPointsEarned
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user