2012-03-10 13:47:47 +00:00
|
|
|
class MashTournamentRound < ActiveRecord::Base
|
|
|
|
belongs_to :tournament, :class_name => 'MashTournament'
|
|
|
|
has_many :mashes
|
|
|
|
|
|
|
|
def self.for_round(tournament, round_number)
|
|
|
|
self.find_by_mash_tournament_id_and_number(tournament, round_number)
|
|
|
|
end
|
2012-03-11 04:28:55 +00:00
|
|
|
|
|
|
|
def done?
|
|
|
|
winners = []
|
|
|
|
self.mashes.collect do |mash|
|
|
|
|
winners << mash.winner_id
|
|
|
|
end
|
|
|
|
!winners.include?(nil)
|
|
|
|
end
|
2012-03-10 13:47:47 +00:00
|
|
|
end
|