Update groups points at start and end of a match
This commit is contained in:
parent
e448f9ccc3
commit
bbb8e209df
|
|
@ -49,6 +49,9 @@ class MatchesController < ApplicationController
|
||||||
Match.transaction do
|
Match.transaction do
|
||||||
if @match.update(match_params)
|
if @match.update(match_params)
|
||||||
handle_match_end if new_state == 'finished'
|
handle_match_end if new_state == 'finished'
|
||||||
|
if @match.group_match? and new_state == "in_progress"
|
||||||
|
UpdateGroupsGroupScoresAndSave.call(group: @match.group)
|
||||||
|
end
|
||||||
|
|
||||||
render json: @match
|
render json: @match
|
||||||
else
|
else
|
||||||
|
|
@ -61,6 +64,7 @@ class MatchesController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def handle_match_end
|
def handle_match_end
|
||||||
|
UpdateGroupsGroupScoresAndSave.call(group: @match.group) if @match.group_match?
|
||||||
return if @match.group_match?
|
return if @match.group_match?
|
||||||
|
|
||||||
if @match.winner.nil?
|
if @match.winner.nil?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue