sorare-rewards 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_division_rarity_and_quality.rb +1 -1
- data/lib/sorare/rewards/interactors/supply/compute_for_rarity.rb +1 -1
- data/lib/sorare/rewards/player.rb +13 -4
- data/lib/sorare/rewards/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc85589244de6f453ed70184da06e8c679ec19b4b2c5fe86ee1ea4936c2c402
|
4
|
+
data.tar.gz: 521385c5b0b1e917d7be61eaef02d2284c24082fb18eeec561f9da6160ea650f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b998f1b6bca4cbb8ca9fc9fcab6b2d9f2f32b7f4384e4b736ec2dcd3b51b9e1e17d62daf7f85b715e21a060445abd5e495342a01bc725994847ca028a991733
|
7
|
+
data.tar.gz: fff45a44fc25d684adeb45985aac4fde3b876977feca1f9fd3b4f9cd7b3e60f82b3f3f0294df25cc28aead951ee16f0b287192d4bb44fb1cd823602067f3ac42
|
data/Gemfile.lock
CHANGED
@@ -32,7 +32,7 @@ module Sorare
|
|
32
32
|
|
33
33
|
def pick_if_available!
|
34
34
|
player = picker.pick
|
35
|
-
return if picker.player_counter[player] > game_week.player(player).
|
35
|
+
return if picker.player_counter[player] > game_week.player(player).pickable_supply(league, rarity)
|
36
36
|
|
37
37
|
cards_picked.push(player)
|
38
38
|
end
|
@@ -25,11 +25,18 @@ module Sorare
|
|
25
25
|
@game_data.present?
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def reward_pool_supply_contribution(league, rarity)
|
29
29
|
return 0 unless playing? && remaining_games_for_supply.positive?
|
30
30
|
|
31
31
|
[
|
32
|
-
uncapped_supply_for_game_week(league, rarity),
|
32
|
+
uncapped_supply_for_game_week(league, rarity),
|
33
|
+
pickable_supply(league, rarity)
|
34
|
+
].min
|
35
|
+
end
|
36
|
+
|
37
|
+
def pickable_supply(league, rarity)
|
38
|
+
[
|
39
|
+
overall_supply(league, rarity), # Remaining supply
|
33
40
|
available_during_cooldown(league, rarity), # Cooldown limit
|
34
41
|
@config.distribution_limit(rarity) # Hard limit
|
35
42
|
].min
|
@@ -52,10 +59,12 @@ module Sorare
|
|
52
59
|
end
|
53
60
|
|
54
61
|
def rewarded_during_cooldown(league, rarity)
|
55
|
-
(
|
62
|
+
(@game_data&.dig(league.name, rarity) || []).count do |at|
|
63
|
+
(Time.parse(at) + @config.cooldown_since(rarity)) > Time.now
|
64
|
+
end
|
56
65
|
end
|
57
66
|
|
58
|
-
%w[
|
67
|
+
%w[remaining_games_for_supply remaining_games].each do |key|
|
59
68
|
define_method(key) do
|
60
69
|
@game_data&.dig(key)
|
61
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorare-rewards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pierre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|