diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/match.rb | 9 | ||||
-rw-r--r-- | app/models/statistic.rb | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/app/models/match.rb b/app/models/match.rb index 7b36777..65e2047 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -20,7 +20,9 @@ class Match < ActiveRecord::Base def finished? ok = true tournament_stage.scoring.stats_needed.each do |stat| - ok &= !statistics.where(match: self, name: stat).nil? + self.users.each do |user| + ok &= statistics.where(match: self, user: user, name: stat) + end end ok end @@ -46,6 +48,11 @@ class Match < ActiveRecord::Base # Delagates PUT/PATCH HTTP params to the appropriate sampling # methods. def handle_sampling(user, params) + require 'pp' + puts('>'*80) + pp user + pp params + puts('<'*80) method_classes.each do |klass| klass.new(self).handle_user_interaction(user, params) end diff --git a/app/models/statistic.rb b/app/models/statistic.rb index d62d413..8abf1f4 100644 --- a/app/models/statistic.rb +++ b/app/models/statistic.rb @@ -23,8 +23,8 @@ class Statistic < ActiveRecord::Base self.match.winner = self.match.teams.find{|t| t.users.include? self.user} end if (self.match.status == 2) and (self.match.finished?) - #self.match.tournament_stage.scoring.score(self.match) self.match.status = 3 + self.match.tournament_stage.scheduling.finish_match(self.match) end self.match.save! end |