Class: Jumbotron::Services::Canonical::ResolveCurrentLinesForGames

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

Constant Summary collapse

GRAIN =
%i[game_id bookmaker_id market outcome source].freeze

Instance Method Summary collapse

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/jumbotron/services/canonical/resolve_current_lines_for_games.rb', line 11

def call
  ids = Array(game_ids).map(&:to_i).uniq
  if ids.empty?
    context.current_lines = []
    context.current_lines_by_game_id = {}
    return
  end

  lines = latest_observed(ids).map { |row| to_current_line(row) }
  context.current_lines = lines
  context.current_lines_by_game_id = lines.group_by(&:game_id)
end