1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-09 15:42:09 +00:00

Added most decision points and quickest pin to the tiebreakers

This commit is contained in:
2015-12-17 14:03:14 +00:00
parent ae056ec7f8
commit 702a52311b
4 changed files with 159 additions and 0 deletions

View File

@@ -157,6 +157,29 @@ class Wrestler < ActiveRecord::Base
matchesWon.select{|m| m.win_type == "Major" }
end
def decisionWins
matchesWon.select{|m| m.win_type == "Decision" }
end
def decisionPointsScored
pointsScored = 0
decisionWins.each do |m|
scoreOfMatch = m.score.delete(" ")
scoreOne = scoreOfMatch.partition('-').first.to_i
scoreTwo = scoreOfMatch.partition('-').last.to_i
if scoreOne > scoreTwo
pointsScored = pointsScored + scoreOne
elsif scoreTwo > scoreOne
pointsScored = pointsScored + scoreTwo
end
end
pointsScored
end
def fastestPin
pinWins.sort_by{|m| m.pinTime}.reverse.first
end
def seasonWinPercentage
win = self.season_win.to_f
loss = self.season_loss.to_f