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.
This commit is contained in:
Daniel Schädler 2019-05-08 21:57:12 +02:00
parent 89486d7349
commit 8157399a1a
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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