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/adapters/build_acquisition_scopes.rb', line 10
def call
seen = {}
scopes = []
incomplete = 0
Array(games).each do |game|
scope = adapter.acquisition_scope_for(game)
if scope.nil?
incomplete += 1
next
end
key = [
scope.fetch(:endpoint),
Synchronization::Lease.normalized_acquisition_parts(scope.fetch(:acquisition))
]
next if seen[key]
seen[key] = true
scopes << { endpoint: scope.fetch(:endpoint), acquisition: scope.fetch(:acquisition) }
end
context.scopes = scopes
context.skipped_incomplete_scope = incomplete
end
|