mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-07 23:17:25 +00:00
Added a bout board
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
class Mat < ActiveRecord::Base
|
||||
belongs_to :tournament
|
||||
has_many :matches
|
||||
|
||||
def assignNextMatch
|
||||
t_matches = tournament.matches.where(mat_id: nil)
|
||||
match = t_matches.order(:bout_number).first
|
||||
match.mat_id = self.id
|
||||
match.save
|
||||
end
|
||||
|
||||
def unfinishedMatches
|
||||
matches.where(finished: nil).order(:bout_number)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user