1
0
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:
2015-11-16 13:31:27 +00:00
parent 34a04be4bf
commit 934ccc28ee
9 changed files with 199 additions and 26 deletions

View File

@@ -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