sorare-rewards 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6897c498226e4f66e5b2a8aa93cd8b46478cc5d48d445950313224fae955922
|
4
|
+
data.tar.gz: 6a317d2b7767bb86bba95b485516923c1f4fe04780507d068b8d5ebd4a34a836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0000887adec07808ab805e1045b196cd413015dd4e99a0b7df65fcf08a6cdf1f7cadd34c976a8da21cbbe72b583f5166e970a624645f02e64c5a77dbc1b119b
|
7
|
+
data.tar.gz: 72f565145aade90fc49552c1940da0e6f93f9e4f80dc179fb90ff9c20ed2c287ab241e5755bab1f750b3e9a8f4a61425b262729cf0e326465be201a35dfdfccc
|
data/Gemfile.lock
CHANGED
@@ -17,10 +17,8 @@ module Sorare
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def allocate_and_format!
|
20
|
-
|
21
|
-
|
22
|
-
allocations.keys.index_with do |rarity|
|
23
|
-
allocations[rarity].first.keys.index_with do |division|
|
20
|
+
each_rarity_allocation do |rarity|
|
21
|
+
(allocations[rarity].first || {}).keys.index_with do |division|
|
24
22
|
allocations[rarity].each_with_index.map do |qualified_allocations, tier|
|
25
23
|
[Sorare::Rewards.configuration.transform_tier.call(tier), qualified_allocations[division]]
|
26
24
|
end.to_h
|
@@ -28,8 +26,12 @@ module Sorare
|
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
def
|
32
|
-
|
29
|
+
def each_rarity_allocation(&block)
|
30
|
+
allocations.keys.index_with(&block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def allocations
|
34
|
+
@allocations ||= (config || {}).keys.index_with do |rarity|
|
33
35
|
ComputeForRarity.call!(**context.to_h, supply: supply[rarity], config: config[rarity]).rarity_allocations
|
34
36
|
end
|
35
37
|
end
|
@@ -15,7 +15,13 @@ module Sorare
|
|
15
15
|
def call
|
16
16
|
context.fail!(error: 'Invalid config') unless config
|
17
17
|
|
18
|
-
context.rarity_allocations =
|
18
|
+
context.rarity_allocations = allocations
|
19
|
+
end
|
20
|
+
|
21
|
+
def allocations
|
22
|
+
return [] unless supply
|
23
|
+
|
24
|
+
supply.each_with_index.map do |tier_supply, tier|
|
19
25
|
ComputeForQuality.call!(
|
20
26
|
**context.to_h,
|
21
27
|
supply: tier_supply,
|