diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-28 18:29:01 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-28 18:29:01 -0400 |
commit | cd19b2591a52ac604632a70929448ee5e78c2568 (patch) | |
tree | 78be624ead45a8b85669f03a04e519a98a283693 /app/controllers/matches_controller.rb | |
parent | 5a7f5f6bc00d2abe2d5cd71363d4d5116bf4de51 (diff) |
Misc fixes. (This commit is from Luke on Andrew's box)
Diffstat (limited to 'app/controllers/matches_controller.rb')
-rw-r--r-- | app/controllers/matches_controller.rb | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index bed06ba..5745ac9 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -45,18 +45,10 @@ class MatchesController < ApplicationController when 2 # Started, waiting to finish @match.handle_sampling(params) - if @match.finished? - @match.status = 3 - respond_to do |format| - if @match.save - format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match has finished.' } - format.json { head :no_content } - else - format.html { render action: 'show' } - format.json { render json: @match.errors, status: :unprocessable_entity } - end - end - return + # The @match.status will be updated by Statistic's after_save hook + respond_to do |format| + format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match has finished.' } + format.json { head :no_content } end when 3 if (@tournament.hosts.include? current_user) and (params[:update_action] == "start") |