Check for errors while populating the match below
This commit is contained in:
parent
fc69c6e6e6
commit
12daf53599
|
|
@ -14,7 +14,11 @@ class MatchesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
new_state = match_params['state']
|
new_state = match_params['state']
|
||||||
if new_state == 'finished'
|
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
|
end
|
||||||
if @match.update(match_params)
|
if @match.update(match_params)
|
||||||
render json: @match
|
render json: @match
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue