summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:04:47 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:04:47 -0400
commit6b66877bda4c0e4a33bb3109304636d5ada85904 (patch)
tree7065307802fec8452afc89c8a7b445fd2ceca772 /app/models
parent33fcf6de9feaaa6f90dfe5082e08d280c930dae1 (diff)
parent7a4832621f1a0bb2e4b86ee9f879a73df0188a3e (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 1edac8f..fa15980 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -5,6 +5,17 @@ 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?
+ end
+ ok
+ end
+
def win?(player)
winner.players.include? player
end