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