From 8db5113a761d443374a64e5e9fe877fafa3f0a50 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 21:21:47 -0400 Subject: Fixed status 2-3 transition and statistic sampling. --- app/models/match.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/models/match.rb b/app/models/match.rb index 219e662..5c3a022 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -7,8 +7,8 @@ class Match < ActiveRecord::Base def finished? ok = true - tournament_stage.scoring_method.stats_needed.each do |stat| - ok &= statistics.where(match: self, name: stat).nil? + tournament_stage.scoring.stats_needed.each do |stat| + ok &= !statistics.where(match: self, name: stat).nil? end ok end -- cgit v1.2.3 From 819fd70c1285bf5670b68842adad8c77c36d1076 Mon Sep 17 00:00:00 2001 From: nfoy Date: Mon, 28 Apr 2014 21:32:04 -0400 Subject: All the changes. Luke should know what's up. --- app/controllers/matches_controller.rb | 1 + app/models/match.rb | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'app') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 81ffcd8..d2dc918 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -31,6 +31,7 @@ class MatchesController < ApplicationController # Scheduled, waiting to start if (@tournament.hosts.include? current_user) and (params[:update_action] == "start") @match.status = 2 + @match.start_sampling respond_to do |format| if @match.save format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match has started.' } diff --git a/app/models/match.rb b/app/models/match.rb index 219e662..57b7d36 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -46,6 +46,12 @@ class Match < ActiveRecord::Base return html.html_safe end + def start_sampling + method_classes.each do |klass| + klass.new(self).start + end + end + private def figure_sampling_methods if @sampling_methods.nil? -- cgit v1.2.3