statisfy 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/statisfy/counter.rb +2 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fefc77edb493e9b299329483e6eee64b163557b2320f03225a492dd60731860e
4
- data.tar.gz: 15efdf6901e8c514011b538da459b2dc2ebd37bcad6e85ec5d5b6d9482116974
3
+ metadata.gz: 3e1e002d54e02e8717c8537367bca6135092525f33c8983aa9aef000df83b04a
4
+ data.tar.gz: 510fcff13694f65533c276431f6d0dc4f02c6b753bebd65716cb1b1c912047a7
5
5
  SHA512:
6
- metadata.gz: 611b63cc3aed721b7f2410af146af9d6a410c8672fa55d9a46dae4231ab8a26d067a7ebb004202611b82d2d35aeb17db0595dcf47c1712bc7ff56f084adbc416
7
- data.tar.gz: b9e84f2a477d91ae022f41a0b8f3f6d604be81654dd83900076d72e6d26c341ea4189b2fe65225cccd3eb1ee389f90095e2ab44cc6f4142ee613c50c309661b8
6
+ metadata.gz: a6cdb0207adb660ac3bfde3fbd42f1f6e3aae762c12ab10941c6b944cecad7f4f49a5c4d5bfeb2c810bbf00fc51069a8c1fe72995ea50860d9ad1e6a2dcf61ca
7
+ data.tar.gz: 29fdcfa2010773fc5c4b4fbcb74863eaea47f4d191852b625196b15c8e572cd14ce609e2ec6a1849e3c548116e8d344ff836ce0dff3fa9e84637c2e458f36bd4
@@ -45,6 +45,7 @@ module Statisfy
45
45
  define_method(:decrement?, args[:decrement_if] || -> { false })
46
46
  define_method(:should_run?, args[:if] || -> { true })
47
47
  define_method(:decrement_on_destroy?, -> { args[:decrement_on_destroy] != false })
48
+ define_method(:month_to_set, args[:date_override] || -> { params["created_at"] })
48
49
  end
49
50
 
50
51
  #
@@ -172,10 +173,6 @@ module Statisfy
172
173
  scopes.flatten.compact << nil
173
174
  end
174
175
 
175
- def month_to_set
176
- params["created_at"].to_date.strftime("%Y-%m")
177
- end
178
-
179
176
  def process_event
180
177
  return decrement if can_decrement_on_destroy?
181
178
  return unless if_async
@@ -200,7 +197,7 @@ module Statisfy
200
197
  # (in general the Department(s) and Organisation(s) for both the current month and the global counter)
201
198
  #
202
199
  def all_counters
203
- [month_to_set, nil].each do |month|
200
+ [month_to_set.to_date.strftime("%Y-%m"), nil].each do |month|
204
201
  scopes_with_global.each do |scope|
205
202
  yield self.class.key_for(scope:, month:)
206
203
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statisfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Villeneuve