11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/services/jumbotron/services/adapters/select_eligible_games.rb', line 11
def call
league = find_league
if league.nil?
context.fail!(
application_error: Jumbotron::Errors::Adapters::LeagueNotFoundError.new(
details: { league_id: "#{adapter.sport}/#{adapter.league}" }
)
)
return
end
games = Game.where(league_id: league.id)
.includes(:season, :season_phase, :schedule_group)
.select { |game| policy.eligible?(game, now: now) }
context.league = league
context.games = games
end
|