1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Added head to head pool winner and tests

This commit is contained in:
2015-11-10 02:58:52 +00:00
parent 201d8d1f62
commit 34a04be4bf
4 changed files with 106 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ class Wrestler < ActiveRecord::Base
belongs_to :weight
has_one :tournament, through: :weight
has_many :matches, through: :weight
attr_accessor :poolNumber
attr_accessor :poolNumber, :poolAdvancePoints
before_save do
self.tournament.destroyAllMatches
@@ -22,6 +22,9 @@ class Wrestler < ActiveRecord::Base
end
end
def matchAgainst(opponent)
allMatches.select{|m| m.w1 == opponent.id or m.w2 == opponent.id}
end
def isWrestlingThisRound(matchRound)
if allMatches.blank?