Class: Sorare::Rewards::Build

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

Overview

Build builds the rewards structure for a given game week

Instance Method Summary collapse

Instance Method Details

#allocate!Object



24
25
26
27
28
# File 'lib/sorare/rewards/interactors/build.rb', line 24

def allocate!
  Allocations::ComputeForGameWeek.call!(
    supply: game_week_supply, public_seed: game_week.public_seed, salt: game_week.salt
  ).game_week_allocations
end

#callObject



14
15
16
17
# File 'lib/sorare/rewards/interactors/build.rb', line 14

def call
  context.card_allocations = allocate!
  context.prize_pools = prize_pools!
end

#game_week_supplyObject



19
20
21
22
# File 'lib/sorare/rewards/interactors/build.rb', line 19

def game_week_supply
  @game_week_supply ||= Supply::ComputeForGameWeek.call!(game_week: game_week)
                                                  .game_week_supply
end

#prize_pools!Object



30
31
32
# File 'lib/sorare/rewards/interactors/build.rb', line 30

def prize_pools!
  PrizePools::ComputeForGameWeek.call!(game_week: game_week).prize_pools
end