diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 28ee8ed..322387a 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -14,7 +14,11 @@ class MatchesController < ApplicationController def update new_state = match_params['state'] if new_state == 'finished' - PopulateMatchBelowAndSave.call(match:@match) unless @match.group_match? + result = PopulateMatchBelowAndSave.call(match: @match) unless @match.group_match? + unless result.success? + render json: { error: 'Moving Team one stage down failed' }, status: :unprocessable_entity + return + end end if @match.update(match_params) render json: @match