sorare-rewards 1.3.0 → 1.4.0

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: 01fd7615db59531b3ff62b6cb1c41ff0df013b21faa6f2cd606dc8c3bfa8ecbb
4
- data.tar.gz: efd268efe1bc3ce02dc7a02c49b0e5caa777152aef6bdb5ada31a38b51f62ca9
3
+ metadata.gz: 385b50a4b23229464d9807665633f7bc5475f2572a1981fb2be18dd5501f3620
4
+ data.tar.gz: 01f7f7d0bed52e96f3caec5743004bb10b16f4a223ce83f804ec4e94d96b4bd3
5
5
  SHA512:
6
- metadata.gz: 29d31f438e4962fa3381f783cd263307f1dfb5562eaf0e8eb06b36dc9aca4848efb03ed4d07e4d12fa5eba77a309873a9add2184f214262ac425287f5767b52d
7
- data.tar.gz: b3eabfe23636dbdb50b18abfc4fbad687ca42c80d5d82e1cb88c5017b754bdf555614e7c3090793adc3493432de76bf53ce3e0194e8d85c7d972fd4eda79f25a
6
+ metadata.gz: 188333489495c2a7ab8e4da7a1f0cd7874131cdb01acde247997f925edf473639db04ee8a7ddb02c8458c77f89888c0bb6a6eaccd724523d86c305cd50c86835
7
+ data.tar.gz: 00c0276d280c1c3b0e5980837709d69d24dbd5263975f33546099589ddca46aeebb8cad4bee0572561bd85febfdea98e986f5cb622ab92bd0bca9d1357500ee0
data/CHANGELOG.md CHANGED
@@ -1,11 +1,23 @@
1
+ ## [1.4.0] - 2021-12-14
2
+
3
+ ### Added
4
+
5
+ - Added support for rarity based `rewards_ratio_per_cards_in_circulation`
6
+
1
7
  ## [1.3.0] - 2021-11-02
8
+
2
9
  ### Breaking
10
+
3
11
  - Removed rewards method from `GameWeek` (`card_rewards`, `cards_picked`, `reward_allocations`, `prize_pools`, `card_allocations`)
4
12
  - `Picker` has been renamed to `CardPicker`
13
+
5
14
  ### Added
15
+
6
16
  - Added a `GameWeekRewards` class that provides all rewards related methods
7
17
  - Added a way to pick cards with a custom `card_allocations`
8
18
 
9
19
  ## [1.2.0] - 2021-11-02
20
+
10
21
  ### Added
22
+
11
23
  - Enable cross leagues cooldown using `per_league` configuration flag
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sorare-rewards (1.3.0)
4
+ sorare-rewards (1.4.0)
5
5
  activesupport (~> 6.1.4)
6
6
  interactor (~> 3.1.2)
7
7
  json (~> 2)
@@ -90,4 +90,4 @@ DEPENDENCIES
90
90
  sorare-rewards!
91
91
 
92
92
  BUNDLED WITH
93
- 2.2.22
93
+ 2.2.30
data/README.md CHANGED
@@ -10,15 +10,14 @@ gem 'sorare-rewards'
10
10
 
11
11
  And then execute:
12
12
 
13
- $ bundle install
13
+ $ bundle install
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install sorare-rewards
17
+ $ gem install sorare-rewards
18
18
 
19
19
  ## Usage
20
20
 
21
-
22
21
  First you need to load a game week
23
22
 
24
23
  ```ruby
@@ -27,7 +26,6 @@ game_week = Sorare::Rewards::GameWeek.new(hash: 'QmbwCo1fuhRN1T2DyEQtETefsBH6yCj
27
26
 
28
27
  Game Week's `hash` and `salt` can be retrieved using the GQL API, the salt is made public after the rewards have been distributed.
29
28
 
30
-
31
29
  To compute rewards for a game week :
32
30
 
33
31
  ```ruby
@@ -67,7 +65,6 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
67
65
 
68
66
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
69
67
 
70
-
71
68
  ## License
72
69
 
73
70
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -24,9 +24,17 @@ module Sorare
24
24
  end
25
25
 
26
26
  def cards_in_circulation_limit(rarity)
27
- return unless cards_in_circulation&.dig(rarity) && game_week.config.rewards_ratio_per_cards_in_circulation
27
+ return unless cards_in_circulation&.dig(rarity) && rewards_ratio_per_cards_in_circulation_for_rarity(rarity)
28
28
 
29
- (cards_in_circulation[rarity] * game_week.config.rewards_ratio_per_cards_in_circulation).floor
29
+ (cards_in_circulation[rarity] * rewards_ratio_per_cards_in_circulation_for_rarity(rarity)).floor
30
+ end
31
+
32
+ def rewards_ratio_per_cards_in_circulation_for_rarity(rarity)
33
+ if game_week.config.rewards_ratio_per_cards_in_circulation.is_a?(Hash)
34
+ return game_week.config.rewards_ratio_per_cards_in_circulation&.dig(rarity)
35
+ end
36
+
37
+ game_week.config.rewards_ratio_per_cards_in_circulation
30
38
  end
31
39
 
32
40
  def each_division_prize_pools
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sorare
4
4
  module Rewards
5
- VERSION = '1.3.0'
5
+ VERSION = '1.4.0'
6
6
  end
7
7
  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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pierre
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 2.5.0
153
- description:
153
+ description:
154
154
  email:
155
155
  - pierre@sorare.com
156
156
  executables: []
@@ -211,7 +211,7 @@ licenses:
211
211
  metadata:
212
212
  homepage_uri: https://gitlab.com/sorare/sorare-rewards
213
213
  source_code_uri: https://gitlab.com/sorare/sorare-rewards
214
- post_install_message:
214
+ post_install_message:
215
215
  rdoc_options: []
216
216
  require_paths:
217
217
  - lib
@@ -226,8 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.2.22
230
- signing_key:
229
+ rubygems_version: 3.1.6
230
+ signing_key:
231
231
  specification_version: 4
232
232
  summary: '["Sorare", "reward", "allocation", "algorithm"]'
233
233
  test_files: []