class Sorare::Rewards::Cards::PickForGameWeek

PickForGameWeek picks the rewards for a given game week Receive a Game Week object And a reward allocations

{
  'global-all_star' => {
    'D1' => {
      'rare' => { 'tier_0': 1, 'tier_1': 1 }
    }
  }
}

Public Instance Methods

call() click to toggle source
# File lib/sorare/rewards/interactors/cards/pick_for_game_week.rb, line 24
def call
  context.cards_picked = pick!
end
pick!() click to toggle source
# File lib/sorare/rewards/interactors/cards/pick_for_game_week.rb, line 28
def pick!
  allocations.each_league_allocations.each_with_object({}) do |(league_name, league_allocations), picks|
    picks[league_name] = PickForLeague.call!(
      **context.to_h, league: game_week.league(league_name), allocations: league_allocations
    ).cards_picked
  end
end