class Sorare::Rewards::Supply::ComputeForGameWeek

ComputeForGameWeek computes the rewardable supply of a game week based on the overall supply

Public Instance Methods

call() click to toggle source
# File lib/sorare/rewards/interactors/supply/compute_for_game_week.rb, line 15
def call
  context.game_week_supply = game_week_supply!
end
game_week_supply!() click to toggle source
# File lib/sorare/rewards/interactors/supply/compute_for_game_week.rb, line 19
def game_week_supply!
  game_week.each_league.each_with_object(Hash.new({})) do |league, game_week_supply|
    game_week_supply[league.name] = league_supply!(league)
  end
end
league_supply!(league) click to toggle source
# File lib/sorare/rewards/interactors/supply/compute_for_game_week.rb, line 25
def league_supply!(league)
  league.each_rarity_supply.each_with_object({}) do |(rarity, supply), league_supply|
    league_supply[rarity] = ComputeForRarity.call!(
      league: league, rarity: rarity, supply: supply, randomizer: randomizer
    ).rarity_supply
  end
end
randomizer() click to toggle source
# File lib/sorare/rewards/interactors/supply/compute_for_game_week.rb, line 33
def randomizer
  @randomizer ||= Sorare::Rewards::Random.new(game_week.public_seed, salt)
end