git-subtree-dir: map-mash git-subtree-mainline: eacc351b17aef1e36dd67b46625d6f9243988b43 git-subtree-split: 7f16409d1257e7471fef35c18bcdf32856b908e3
17 lines
392 B
Ruby
17 lines
392 B
Ruby
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
|
|
|
|
def done?
|
|
winners = []
|
|
self.mashes.collect do |mash|
|
|
winners << mash.winner_id
|
|
end
|
|
!winners.include?(nil)
|
|
end
|
|
end
|