Class: Sorare::Rewards::PrizePools::ComputeForDivision
- Inherits:
-
Object
- Object
- Sorare::Rewards::PrizePools::ComputeForDivision
- Includes:
- Interactor
- Defined in:
- lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb
Overview
ComputeForDivision computes the prize pools of a division
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
15 16 17 18 19 |
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 15 def call context.division_prize_pools = available_prize_pools.map do |available_prize_pool| (available_prize_pool * percentage_rewarded).round(2) end end |
#config ⇒ Object
27 28 29 |
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 27 def config Sorare::Rewards.configuration.prize_pool_configuration end |
#percentage_rewarded ⇒ Object
21 22 23 24 25 |
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 21 def percentage_rewarded @percentage_rewarded ||= (config.find do |rate_config| (rate_config.dig('playing_rates', 0)...rate_config.dig('playing_rates', 1)).include?() end || config.last)['percentage_rewarded'] end |