Class: Jumbotron::Services::Canonical::EnsureSeasonPhase

Inherits:
CommandTower::Services::ApplicationService
  • Object
show all
Defined in:
app/services/jumbotron/services/canonical/ensure_season_phase.rb

Instance Method Summary collapse

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
# File 'app/services/jumbotron/services/canonical/ensure_season_phase.rb', line 10

def call
  context.season_phase = SeasonPhase.find_or_create_by!(season_id: season.id, name: phase_key.to_s)
rescue ActiveRecord::RecordInvalid => e
  context.fail!(
    application_error: Jumbotron::Errors::Canonical::MutationFailedError.new(
      details: { message: e.message }
    )
  )
end