Respond with 501 for state param 'finished'

(501 = NOT IMPLEMENTED)
This commit is contained in:
Thor77 2019-05-07 18:29:46 +02:00
parent 3876f57d32
commit 27c4bcacc8
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,12 @@ class MatchesController < ApplicationController
# PATCH/PUT /matches/1 # PATCH/PUT /matches/1
def update def update
new_state = match_params['state']
if new_state == 'finished'
# implement logic to move the winning team into the next stage
match_params['state'] = 'team1_won' # or 'team2_won' or 'undecided'
render json: {}, status: :not_implemented
end
if @match.update(match_params) if @match.update(match_params)
render json: @match render json: @match
else else