mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Deducted points pool tie breaker added
This commit is contained in:
@@ -3,14 +3,23 @@ class Wrestler < ActiveRecord::Base
|
||||
belongs_to :weight
|
||||
has_one :tournament, through: :weight
|
||||
has_many :matches, through: :weight
|
||||
has_many :deductedPoints, class_name: "Teampointadjust"
|
||||
attr_accessor :poolNumber, :poolAdvancePoints
|
||||
|
||||
before_save do
|
||||
self.tournament.destroyAllMatches
|
||||
end
|
||||
|
||||
def totalDeductedPoints
|
||||
points = 0
|
||||
self.deductedPoints.each do |d|
|
||||
points = points + d.points
|
||||
end
|
||||
points
|
||||
end
|
||||
|
||||
def resultByBout(bout)
|
||||
@match = Match.where("bout_number = ? AND finished = ?",bout,1)
|
||||
@match = allMatches.select{|m| m.bout_number == bout and m.finished == 1}
|
||||
if @match.size == 0
|
||||
return ""
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user