summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/matches_controller.rb11
1 files changed, 9 insertions, 2 deletions
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.' }