1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-16 04:56:58 +00:00

Testing team points for pool to bracket

This commit is contained in:
2015-11-17 19:03:34 +00:00
parent 61ed7c9d69
commit 67727c6391
4 changed files with 121 additions and 8 deletions

View File

@@ -7,13 +7,19 @@ class Match < ActiveRecord::Base
after_save do
if self.finished == 1
advance_wrestlers
self.wrestler1.school.calcScore
self.wrestler2.school.calcScore
calcSchoolPoints
end
end
WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"]
def calcSchoolPoints
if self.w1? && self.w2?
wrestler1.school.calcScore
wrestler2.school.calcScore
end
end
def advance_wrestlers
if self.w1? && self.w2?
@w1 = wrestler1

View File

@@ -15,6 +15,10 @@ class Wrestler < ActiveRecord::Base
end
def totalTeamPoints
teamPointsEarned - totalDeductedPoints
end
def teamPointsEarned
points = 0.0
points = points + (poolWins.size * 1) + (pinWins.size * 2) + (techWins.size * 1.5) + (majorWins.size * 1) + placementPoints
end