Class: Sorare::Rewards::Allocations::ComputeForGameWeek

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
lib/sorare/rewards/interactors/allocations/compute_for_game_week.rb

Overview

ComputeForGameWeek computes the reward allocations for a game week given a supply and seed

Instance Method Summary collapse

Instance Method Details

#allocationsObject



21
22
23
24
25
26
27
# File 'lib/sorare/rewards/interactors/allocations/compute_for_game_week.rb', line 21

def allocations
  supply.keys.index_with do |league|
    Allocations::ComputeForLeague.call!(
      **context.to_h, supply: supply[league], config: config[league]
    ).league_allocations
  end
end

#callObject



16
17
18
19
# File 'lib/sorare/rewards/interactors/allocations/compute_for_game_week.rb', line 16

def call
  context.randomizer = Sorare::Rewards::Random.new(public_seed, salt)
  context.game_week_allocations = allocations
end

#configObject



29
30
31
# File 'lib/sorare/rewards/interactors/allocations/compute_for_game_week.rb', line 29

def config
  Sorare::Rewards.configuration.allocation_configuration
end