From a812e7103d01911a8af0d0912a0247278eb1972a Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Wed, 8 May 2019 21:57:12 +0200 Subject: [PATCH] Change status of Match to only represent being finished The winner will be a attribute of the Match instead of something that is written in its status. --- app/controllers/matches_controller.rb | 2 +- app/models/match.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index c65b521..0d444fa 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -15,7 +15,7 @@ class MatchesController < ApplicationController 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' + match_params['state'] = 'finished' # or 'team2_won' or 'undecided' render json: {}, status: :not_implemented end if @match.update(match_params) diff --git a/app/models/match.rb b/app/models/match.rb index 8b3ba33..8007619 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class Match < ApplicationRecord - enum state: %i[single_team not_ready not_started in_progress team1_won team2_won undecided] + enum state: %i[single_team not_ready not_started in_progress finished undecided] belongs_to :stage, optional: true belongs_to :group, optional: true