effective_memberships 0.10.0 → 0.10.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: 978c99bc1bc8f0106fac7867dc8a07acea70bd94456d248e20cbb2e57c633b76
4
- data.tar.gz: af1183a241f5b564c7b3ca4aa1ded0768dfde262d3b75da1933ddd177e430ede
3
+ metadata.gz: '09cdd3d71c709fdaacb54d4abd0d21217bd6e7e3a7395e687004eb124994b75b'
4
+ data.tar.gz: caebcbe36b5c113d715e47ef8df0d224f7ea825ae0fa3ea3f5efc59448bcc30f
5
5
  SHA512:
6
- metadata.gz: caa13055dda3360d3d1426710a39923cc79fcf99cf0af710acead650e3f56089d068e4d30fde0072ba2708cc144515a948a4a265624f0726e6afee4e1457861d
7
- data.tar.gz: 5f8241aba4c6d6ca7757346ae74520993d48d4d04af8c5bdf486337ec2e939da8f2d7641fe746319d8c284190c07594b0be1b675240e996beee98815bb124c74
6
+ metadata.gz: 50897b485cca843711185839c1e630b90211ac1559c7a956fd5d425d70a37ad7ef94b6a3863cd1055ac8efa226ef635a4b6186f32763e260c277cb198b4c7f3c
7
+ data.tar.gz: 0a53cc0947501e0f89c07d56e052b81f5b6a7f2c676698e5e45227f0c9ae460b8c674d90fd0bc521601eb5adef49ab07d1433ce6ccd5f80fcefb670b6c9845d6
@@ -267,8 +267,25 @@ module EffectiveMembershipsOwner
267
267
  # Build the renewal fee
268
268
  fee ||= fees.build()
269
269
 
270
- late_on ||= EffectiveMemberships.Registrar.late_fee_date(period: period) if category.create_late_fees?
271
- not_in_good_standing_on ||= EffectiveMemberships.Registrar.not_in_good_standing_date(period: period) if category.create_not_in_good_standing?
270
+ # Late on this period's late date, or 60 days, whichever is later
271
+ late_on ||= if category.create_late_fees?
272
+ late_date = EffectiveMemberships.Registrar.late_fee_date(period: period)
273
+
274
+ duration = EffectiveMemberships.Registrar.min_late_duration
275
+ min_date = ((fee.created_at || Time.zone.now) + duration) if duration.present?
276
+
277
+ [late_date, min_date].compact.max
278
+ end
279
+
280
+ # NIGS on this period's late date, or 60 days, whichever is later
281
+ not_in_good_standing_on ||= if category.create_not_in_good_standing?
282
+ nigs_date = EffectiveMemberships.Registrar.not_in_good_standing_date(period: period)
283
+
284
+ duration = EffectiveMemberships.Registrar.min_not_in_good_standing_duration
285
+ min_date = ((fee.created_at || Time.zone.now) + duration) if duration.present?
286
+
287
+ [nigs_date, min_date].compact.max
288
+ end
272
289
 
273
290
  fee.assign_attributes(
274
291
  fee_type: 'Renewal',
@@ -33,6 +33,18 @@ module EffectiveMembershipsRegistrar
33
33
  raise('to be implemented by app registrar')
34
34
  end
35
35
 
36
+ # A renewal fee must be at least this old to be considered late?
37
+ # Must be less than (late_fee_date - renewal_fee_date) but this is not enforced
38
+ def min_late_duration
39
+ 60.days
40
+ end
41
+
42
+ # A renewal fee must be at least this old to be considered nigs?
43
+ # Must be less than (nigs_date - renewal_fee_date) but this is not enforced
44
+ def min_not_in_good_standing_duration
45
+ 60.days
46
+ end
47
+
36
48
  # scope
37
49
  def not_in_good_standing_status
38
50
  EffectiveMemberships.Status.where(title: 'Not In Good Standing')
@@ -87,14 +87,26 @@ module Effective
87
87
  return false if late_on.blank?
88
88
  return false if purchased?
89
89
 
90
- late_on <= Time.zone.now.to_date
90
+ now = Time.zone.now
91
+
92
+ if(duration = EffectiveMemberships.Registrar.min_late_duration).present?
93
+ return false if ((created_at || now) + duration > now)
94
+ end
95
+
96
+ late_on <= now.to_date
91
97
  end
92
98
 
93
99
  def not_in_good_standing?
94
100
  return false if not_in_good_standing_on.blank?
95
101
  return false if purchased?
96
102
 
97
- not_in_good_standing_on <= Time.zone.now.to_date
103
+ now = Time.zone.now
104
+
105
+ if(duration = EffectiveMemberships.Registrar.min_not_in_good_standing_duration).present?
106
+ return false if ((created_at || now) + duration > now)
107
+ end
108
+
109
+ not_in_good_standing_on <= now.to_date
98
110
  end
99
111
 
100
112
  # Used by applicant.applicant_submit_fees
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.10.0'
2
+ VERSION = '0.10.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_memberships
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails