From a990645f8fb9095e6edd9ec09eadbd9a53b72bc8 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Wed, 8 May 2019 21:24:19 +0200 Subject: [PATCH] Start implementing match start --- app/interactors/start_match.rb | 15 +++++++++++++++ app/services/match_service.rb | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 app/interactors/start_match.rb diff --git a/app/interactors/start_match.rb b/app/interactors/start_match.rb new file mode 100644 index 0000000..45d7e69 --- /dev/null +++ b/app/interactors/start_match.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class StartMatch + include Interactor + + def call + match = context.match + begin + match = MatchService.start_match(match) + context.object_to_save = match + rescue StandardError + context.fail! + end + end +end diff --git a/app/services/match_service.rb b/app/services/match_service.rb index adf2995..26d0095 100644 --- a/app/services/match_service.rb +++ b/app/services/match_service.rb @@ -1,6 +1,12 @@ # frozen_string_literal: true class MatchService + # Starts a Match; setting its state to running + # + # @param match Match the Match to be started + # @return Match the resulting Match + def self.start_match(match); end + # Generates all necessary matches from a list of teams # # @param teams [Array] the teams to generate matches with