Add UpdateMatchScore Interactor
This interactor updates the match score and its state accordingly for a running match
This commit is contained in:
parent
813ab04704
commit
1bdf99ebe9
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UpdateMatchScore
|
||||
include Interactor
|
||||
|
||||
def call
|
||||
match_score = context.match_score
|
||||
match_score_params = context.match_score_params
|
||||
if match_score.update(match_score_params)
|
||||
match_score.match.state = 'in_progress'
|
||||
context.fail! unless match_score.save
|
||||
else
|
||||
context.fail!
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue