summaryrefslogtreecommitdiff
path: root/app/controllers/matches_controller.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-07 11:52:21 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-07 11:52:21 -0400
commitd6b32cbd1234634740fda22f43c1dd1b31b20d35 (patch)
treee93d263ecd89b296e8534e6198bf655db439c73d /app/controllers/matches_controller.rb
parent8f06eb768d3f674c04767f020b8bef52b8f3a879 (diff)
MatchesController: skip peer review if there aren't enough players/team
Diffstat (limited to 'app/controllers/matches_controller.rb')
-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.' }