1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00

Fix team points per OHSAA

This commit is contained in:
2020-01-07 07:25:49 -05:00
parent 981ba3d530
commit 6acea87822
7 changed files with 93 additions and 23 deletions

View File

@@ -96,6 +96,8 @@ class Weight < ActiveRecord::Base
return "fourPoolsToSemi"
elsif self.wrestlers.size > 16 && self.wrestlers.size <= 24
return "eightPoolsToQuarter"
elsif self.wrestlers.size <= 6
return "onePool"
end
end

View File

@@ -2,6 +2,7 @@ class PoolBracketPlacementPoints
def initialize(wrestler)
@wrestler = wrestler
@bracket = wrestler.weight.pool_bracket_type
@largest_bracket = wrestler.tournament.weights.sort_by{|w| w.wrestlers.size}.first.pool_bracket_type
end
def calcPoints
@@ -21,6 +22,14 @@ class PoolBracketPlacementPoints
end
return @points
end
def number_of_placers
if @largest_bracket == "twoPoolsToSemi" or @largest_bracket == "twoPoolsToFinal" or @largest_bracket == "onePool"
return 4
else
return 8
end
end
def whilePointsAreZero
if @points == 0
@@ -108,34 +117,50 @@ class PoolBracketPlacementPoints
end
def firstPlace
16
if number_of_placers == 4
return 14
else
return 16
end
end
def secondPlace
12
if number_of_placers == 4
return 10
else
return 12
end
end
def thirdPlace
10
if number_of_placers == 4
return 9
else
return 7
end
end
def fourthPlace
9
if number_of_placers == 4
return 4
else
return 7
end
end
def fifthPlace
7
5
end
def sixthPlace
6
3
end
def seventhPlace
4
2
end
def eighthPlace
3
1
end
end

View File

@@ -27,15 +27,58 @@
<li>Win by tech fall: 1.5pt extra</li>
<li>Win by fall, default, dq: 2pt extra</li>
<li>BYE points: 2pt (if you win at least 1 match in a pool with a BYE)</li>
<li>1st place: 16pt</li>
<li>2nd place: 12pt</li>
<li>3rd place: 10pt</li>
<li>4th place: 9pt</li>
<li>5th place: 7pt</li>
<li>6th place: 6pt</li>
<li>7th place: 4pt</li>
<li>8th place: 3pt</li>
</ul>
<p>Placement points will happen as follows (based on the largest bracket of the tournament):</p>
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>Number of Places</th>
<th>1st Place Points</th>
<th>2nd Place Points</th>
<th>3rd Place Points</th>
<th>4th Place Points</th>
<th>5th Place Points</th>
<th>6th Place Points</th>
<th>7th Place Points</th>
<th>8th Place Points</th>
</tr>
</thead>
<tbody>
<tr>
<td>1st-4th</td>
<td>14</td>
<td>10</td>
<td>7</td>
<td>4</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1st-6th</td>
<td>16</td>
<td>12</td>
<td>9</td>
<td>7</td>
<td>5</td>
<td>3</td>
<td></td>
<td></td>
</tr>
<tr>
<td>1st-8th</td>
<td>16</td>
<td>12</td>
<td>9</td>
<td>7</td>
<td>5</td>
<td>3</td>
<td>2</td>
<td>1</td>
</tr>
</tbody>
</table>
<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>Pool Types</h4>

View File

@@ -72,12 +72,12 @@ class EightPoolMatchGenerationTest < ActionDispatch::IntegrationTest
wrestler = get_wrestler_by_name("Test1")
match.w1 = wrestler.id
match.save
assert wrestler.reload.placement_points == 3
assert wrestler.reload.placement_points == 1
match2 = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
match2.w1 = wrestler.id
match2.save
assert wrestler.reload.placement_points == 9
assert wrestler.reload.placement_points == 7
end
test "Run through all matches works" do

View File

@@ -72,12 +72,12 @@ class FourPoolToQuarterGenerationTest < ActionDispatch::IntegrationTest
wrestler = get_wrestler_by_name("Test1")
match.w1 = wrestler.id
match.save
assert wrestler.reload.placement_points == 3
assert wrestler.reload.placement_points == 1
match2 = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
match2.w1 = wrestler.id
match2.save
assert wrestler.reload.placement_points == 9
assert wrestler.reload.placement_points == 7
end
test "Run through all matches works" do

View File

@@ -66,12 +66,12 @@ class FourPoolToSemiGenerationTest < ActionDispatch::IntegrationTest
wrestler = get_wrestler_by_name("Test1")
match.w1 = wrestler.id
match.save
assert wrestler.reload.placement_points == 3
assert wrestler.reload.placement_points == 1
match2 = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
match2.w1 = wrestler.id
match2.save
assert wrestler.reload.placement_points == 9
assert wrestler.reload.placement_points == 7
end
test "Run through all matches works" do

View File

@@ -51,7 +51,7 @@ class TwoPoolToSemiGenerationTest < ActionDispatch::IntegrationTest
wrestler = get_wrestler_by_name("Test1")
match.w1 = wrestler.id
match.save
assert wrestler.reload.placement_points == 9
assert wrestler.reload.placement_points == 4
end
test "Run through all matches works" do