Class: Jumbotron::Services::Public::ReadSchedule

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

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/services/jumbotron/services/public/read_schedule.rb', line 9

def call
  league = resolve_league
  return if context.failure?

  if league.nil?
    not_found("league_not_found", "league was not found")
    return
  end

  season = resolve_season(league)
  return if context.failure?

  phase = resolve_phase(season)
  return if context.failure?

  group = resolve_group(season, phase)
  return if context.failure?

  games = load_games(league, season, phase, group)
  context.league = league
  context.season = season
  context.season_phase = phase
  context.schedule_group = group
  context.games = games
end