Add Interactor to add group stage to a tournament
This commit is contained in:
parent
1fdc292aaa
commit
9fc26b27ab
|
|
@ -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