From d6b32cbd1234634740fda22f43c1dd1b31b20d35 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 7 Apr 2014 11:52:21 -0400 Subject: MatchesController: skip peer review if there aren't enough players/team --- app/controllers/matches_controller.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/controllers/matches_controller.rb') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 10c45b0..b6fde0a 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -168,8 +168,6 @@ class MatchesController < ApplicationController end end when "finish" - @match.status = 2 - # Individual scores scores = params["scores"] scores.each do |user_name, score| @@ -193,6 +191,15 @@ class MatchesController < ApplicationController @match.winner.matches.push(@tournament.matches_ordered[cur_match_num/2]) end + # Skip peer evaluation if there aren't enough players per team + peer = false + @match.teams.each do |team| + if team.users.count > 2 + peer = true + end + end + @match.status = peer ? 2 : 3 + respond_to do |format| if @match.save format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Peer evaluation started.' } -- cgit v1.2.3