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:
parent
89486d7349
commit
8157399a1a
|
|
@ -15,7 +15,7 @@ class MatchesController < ApplicationController
|
||||||
new_state = match_params['state']
|
new_state = match_params['state']
|
||||||
if new_state == 'finished'
|
if new_state == 'finished'
|
||||||
# implement logic to move the winning team into the next stage
|
# 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
|
render json: {}, status: :not_implemented
|
||||||
end
|
end
|
||||||
if @match.update(match_params)
|
if @match.update(match_params)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Match < ApplicationRecord
|
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 :stage, optional: true
|
||||||
belongs_to :group, optional: true
|
belongs_to :group, optional: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue