Check for errors while populating the match below
This commit is contained in:
parent
aac0bcb8c8
commit
0573651919
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue