1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-07 06:54:16 +00:00

Working on generating rounds in tournament model

This commit is contained in:
2015-02-02 15:45:46 -05:00
parent 9de0215a5e
commit 7ea80b2997
8 changed files with 78 additions and 9 deletions

View File

@@ -1,16 +1,23 @@
class Wrestler < ActiveRecord::Base
belongs_to :school
belongs_to :weight
has_many :matches
attr_accessor :matches_all, :isWrestlingThisRound
def isWrestlingThisRound?(round)
@r = Match.where(r_id: self.id, round: round)
@g = Match.where(g_id: self.id, round: round)
if @r or @g
def isWrestlingThisRound(round)
@gMatches = Match.where(g_id: self.id, round: round)
@rMatches = Match.where(r_id: self.id, round: round)
@allMatches = @gMatches + @rMatches
if @allMatches == nil
return true
else
return false
end
end
end
def matches_all
@gMatches = Match.where(g_id: self.id)
@rMatches = Match.where(r_id: self.id)
return @gMatches + @rMatches
end
end