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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user