summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index c2df6e0..d4c0ce5 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -5,6 +5,16 @@ class Match < ActiveRecord::Base
belongs_to :winner, class_name: "Team"
+ def setup()
+ end
+
+ def finished?
+ ok = true
+ tournament_stage.scoring_method.stats_needed.each do |stat|
+ ok &= statistics.where(match: self, name: stat).nil?
+ ok
+ end
+
def win?(player)
winner.players.include? player
end