From 27c4bcacc8bd07eb1d1310ad11c3eeb3f7dd05e5 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Tue, 7 May 2019 18:29:46 +0200 Subject: [PATCH] Respond with 501 for state param 'finished' (501 = NOT IMPLEMENTED) --- app/controllers/matches_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 10ba52f..c65b521 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -12,6 +12,12 @@ class MatchesController < ApplicationController # PATCH/PUT /matches/1 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) render json: @match else