Add Interactor to add group stage to a tournament
This commit is contained in:
parent
4059c0d09c
commit
161e46978d
|
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddGroupStageToTournament
|
||||
include Interactor
|
||||
|
||||
def call
|
||||
tournament = context.tournament
|
||||
groups = context.groups
|
||||
context.fail! if tournament.stages.size > 1
|
||||
if (group_stage = GroupStageService.generate_group_stage(groups))
|
||||
tournament.stages = [group_stage]
|
||||
context.tournament = tournament
|
||||
else
|
||||
context.fail!
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue