effective_memberships 0.12.1 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/effective_memberships_registrar.rb +37 -25
- data/app/models/effective/registrar.rb +3 -3
- data/app/views/admin/categories/_fees_additional.html.haml +1 -0
- data/app/views/admin/categories/_fees_applicant.html.haml +23 -0
- data/app/views/admin/categories/_fees_late.html.haml +10 -0
- data/app/views/admin/categories/_fees_nigs.html.haml +8 -0
- data/app/views/admin/categories/_fees_renewal.html.haml +9 -0
- data/app/views/admin/categories/_form_fees.html.haml +5 -54
- data/config/locales/effective_memberships.en.yml +1 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b99c254dcb327566bd4de3e1893a6b94874e055f92b03f79a6f5ee156e48c6
|
4
|
+
data.tar.gz: 732a011869b5756269d5869b2465aec166b1cdaa8cafeb6f359114d8b544d382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f1ebd7606208e5603b2039368623427b87ca92888f635f7593efb1b822d40e2821c6a4894df4d935a4cdc5ac9269ce80269e17fc99e772dd00bf1123ef04648
|
7
|
+
data.tar.gz: 299039b2e0ec8fce83317e9033e62cb6cc6688156ee78fbd6b296c15ccfb0e6ea75a36de48a32d782b539eb06188fb5d2929e547de44bc827deb026839fde6c8
|
@@ -19,17 +19,17 @@ module EffectiveMembershipsRegistrar
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def renewal_fee_date(date:)
|
22
|
-
|
22
|
+
Time.zone.local(date.year, 12, 1) # Fees roll over every December 1st
|
23
23
|
raise('to be implemented by app registrar')
|
24
24
|
end
|
25
25
|
|
26
26
|
def late_fee_date(period:)
|
27
|
-
|
27
|
+
Time.zone.local(period.year, 2, 1) # Fees are late after February 1st
|
28
28
|
raise('to be implemented by app registrar')
|
29
29
|
end
|
30
30
|
|
31
31
|
def not_in_good_standing_date(period:)
|
32
|
-
|
32
|
+
Time.zone.local(period.year, 3, 1) # Membership in bad standing after March 1st
|
33
33
|
raise('to be implemented by app registrar')
|
34
34
|
end
|
35
35
|
|
@@ -54,7 +54,7 @@ module EffectiveMembershipsRegistrar
|
|
54
54
|
EffectiveMemberships.Status.where(title: 'Not In Good Standing').first!
|
55
55
|
end
|
56
56
|
|
57
|
-
#
|
57
|
+
# These two could be overridden if we do non 1-year periods
|
58
58
|
def advance_period(period:, number:)
|
59
59
|
period.advance(years: number).beginning_of_year
|
60
60
|
end
|
@@ -147,8 +147,8 @@ module EffectiveMembershipsRegistrar
|
|
147
147
|
|
148
148
|
# Or, Build Fees
|
149
149
|
unless skip_fees
|
150
|
-
|
151
|
-
raise('
|
150
|
+
fees = build_register_fees(owner: owner, membership: membership, date: date)
|
151
|
+
raise('unexpected purchased fee') if Array(fees).compact.any?(&:purchased?)
|
152
152
|
end
|
153
153
|
|
154
154
|
# Assign member role
|
@@ -159,6 +159,10 @@ module EffectiveMembershipsRegistrar
|
|
159
159
|
owner.save!
|
160
160
|
end
|
161
161
|
|
162
|
+
def build_register_fees(owner:, membership:, date:)
|
163
|
+
owner.build_prorated_fee(date: date)
|
164
|
+
end
|
165
|
+
|
162
166
|
def reclassify!(owner, to:, status: nil, date: nil, skip_fees: false)
|
163
167
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
164
168
|
raise('owner must have an existing membership. use register! instead') if owner.membership.blank?
|
@@ -187,18 +191,8 @@ module EffectiveMembershipsRegistrar
|
|
187
191
|
membership.build_membership_status(status: status) if status.present?
|
188
192
|
|
189
193
|
unless skip_fees
|
190
|
-
|
191
|
-
|
192
|
-
if existing
|
193
|
-
fee = owner.build_prorated_fee(date: date)
|
194
|
-
raise('already has purchased prorated fee') if fee.purchased?
|
195
|
-
|
196
|
-
fee = owner.build_discount_fee(date: date, from: from)
|
197
|
-
raise('already has purchased discount fee') if fee.purchased?
|
198
|
-
else
|
199
|
-
fee = owner.build_renewal_fee(category: to, period: period)
|
200
|
-
raise('already has purchased renewal fee') if fee.purchased?
|
201
|
-
end
|
194
|
+
fees = build_reclassify_fees(owner: owner, membership: membership, to: to, from: from, period: period, date: date)
|
195
|
+
raise('unexpected purchased fee') if Array(fees).compact.any?(&:purchased?)
|
202
196
|
end
|
203
197
|
|
204
198
|
# Save owner
|
@@ -206,6 +200,19 @@ module EffectiveMembershipsRegistrar
|
|
206
200
|
owner.save!
|
207
201
|
end
|
208
202
|
|
203
|
+
def build_reclassify_fees(owner:, membership:, to:, from:, period:, date:)
|
204
|
+
existing = owner.membership_period_fee(category: from, period: period)
|
205
|
+
|
206
|
+
if existing
|
207
|
+
[
|
208
|
+
owner.build_prorated_fee(date: date),
|
209
|
+
owner.build_discount_fee(date: date, from: from)
|
210
|
+
]
|
211
|
+
else
|
212
|
+
owner.build_renewal_fee(category: to, period: period)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
209
216
|
def reinstate!(owner, to: nil, date: nil, skip_fees: false)
|
210
217
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
211
218
|
|
@@ -251,7 +258,7 @@ module EffectiveMembershipsRegistrar
|
|
251
258
|
|
252
259
|
# Or, Build Fees
|
253
260
|
unless skip_fees
|
254
|
-
|
261
|
+
build_reinstate_fees(owner: owner, membership: membership, date: date)
|
255
262
|
# This might already be present and purchased if joined and reinstated in the same period
|
256
263
|
end
|
257
264
|
|
@@ -263,6 +270,10 @@ module EffectiveMembershipsRegistrar
|
|
263
270
|
owner.save!
|
264
271
|
end
|
265
272
|
|
273
|
+
def build_reinstate_fees(owner:, membership:, date:)
|
274
|
+
owner.build_prorated_fee(date: date)
|
275
|
+
end
|
276
|
+
|
266
277
|
def status_clear!(owner, date: nil)
|
267
278
|
raise('expecting a memberships owner') unless owner.class.respond_to?(:effective_memberships_owner?)
|
268
279
|
raise('owner must have an existing membership. use register! instead') if owner.membership.blank?
|
@@ -464,8 +475,7 @@ module EffectiveMembershipsRegistrar
|
|
464
475
|
memberships = Effective::Membership.deep.with_unpaid_fees_through(period)
|
465
476
|
|
466
477
|
memberships.find_each do |membership|
|
467
|
-
create_fees!(membership, period: period)
|
468
|
-
GC.start
|
478
|
+
create_fees!(membership, period: period); GC.start
|
469
479
|
end
|
470
480
|
|
471
481
|
true
|
@@ -496,9 +506,9 @@ module EffectiveMembershipsRegistrar
|
|
496
506
|
|
497
507
|
fee = membership.owner.build_renewal_fee(category: category, period: period)
|
498
508
|
raise("expected build_renewal_fee to return a fee for period #{period}") unless fee.kind_of?(Effective::Fee)
|
499
|
-
next if fee.
|
509
|
+
next if fee.blank? || fee.persisted?
|
500
510
|
|
501
|
-
puts("Created renewal fee for #{membership.owner}") if
|
511
|
+
puts("Created renewal fee for #{membership.owner}") if debug?
|
502
512
|
|
503
513
|
fee.save!
|
504
514
|
end
|
@@ -507,16 +517,18 @@ module EffectiveMembershipsRegistrar
|
|
507
517
|
def create_late_fees!(membership, period:)
|
508
518
|
membership.categories.select(&:create_late_fees?).map do |category|
|
509
519
|
fee = membership.owner.build_late_fee(category: category, period: period)
|
510
|
-
next if fee.blank? || fee.
|
520
|
+
next if fee.blank? || fee.persisted?
|
511
521
|
|
512
|
-
puts("Created late fee for #{membership.owner}") if
|
522
|
+
puts("Created late fee for #{membership.owner}") if debug?
|
513
523
|
|
514
524
|
fee.save!
|
515
525
|
end
|
516
526
|
end
|
517
527
|
|
518
528
|
def create_not_in_good_standing!(membership, period:)
|
529
|
+
return unless Time.zone.now.beginning_of_day == not_in_good_standing_date(period: period).beginning_of_day
|
519
530
|
return unless membership.categories.any?(&:create_not_in_good_standing?)
|
531
|
+
|
520
532
|
membership.owner.update_membership_status!
|
521
533
|
end
|
522
534
|
|
@@ -4,15 +4,15 @@ module Effective
|
|
4
4
|
include EffectiveMembershipsRegistrar
|
5
5
|
|
6
6
|
def renewal_fee_date(date:)
|
7
|
-
|
7
|
+
Time.zone.local(date.year, 12, 1) # Fees roll over every December 1st
|
8
8
|
end
|
9
9
|
|
10
10
|
def late_fee_date(period:)
|
11
|
-
|
11
|
+
Time.zone.local(period.year, 2, 1) # Fees are late after February 1st
|
12
12
|
end
|
13
13
|
|
14
14
|
def not_in_good_standing_date(period:)
|
15
|
-
|
15
|
+
Time.zone.local(period.year, 3, 1) # Membership are Not In Good Standing after March 1st
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
- # Intentionally blank. Used to extend category fees form.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%h3 Applicant Fees
|
2
|
+
.row
|
3
|
+
.col= f.price_field :applicant_fee
|
4
|
+
.col= f.text_field :qb_item_name, label: "Quickbooks Item Name"
|
5
|
+
|
6
|
+
%h3 Pro-rated fees based on date of approval
|
7
|
+
.row
|
8
|
+
.col-lg-3
|
9
|
+
= f.price_field :prorated_jan, label: "January"
|
10
|
+
= f.price_field :prorated_feb, label: "February"
|
11
|
+
= f.price_field :prorated_mar, label: "March"
|
12
|
+
.col-lg-3
|
13
|
+
= f.price_field :prorated_apr, label: "April"
|
14
|
+
= f.price_field :prorated_may, label: "May"
|
15
|
+
= f.price_field :prorated_jun, label: "June"
|
16
|
+
.col-lg-3
|
17
|
+
= f.price_field :prorated_jul, label: "July"
|
18
|
+
= f.price_field :prorated_aug, label: "August"
|
19
|
+
= f.price_field :prorated_sep, label: "September"
|
20
|
+
.col-lg-3
|
21
|
+
= f.price_field :prorated_oct, label: "October"
|
22
|
+
= f.price_field :prorated_nov, label: "November"
|
23
|
+
= f.price_field :prorated_dec, label: "December"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%h3 Late Fees
|
2
|
+
= f.check_box :create_late_fees, label: 'Yes, late fees should be created'
|
3
|
+
|
4
|
+
= f.show_if(:create_late_fees, true) do
|
5
|
+
- period = EffectiveMemberships.Registrar.current_period
|
6
|
+
- date = EffectiveMemberships.Registrar.late_fee_date(period: period)
|
7
|
+
|
8
|
+
%p Charged to members, on #{date.strftime('%B %e')}, with outstanding renewal dues or other fees.
|
9
|
+
.row
|
10
|
+
.col-3= f.price_field :late_fee
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%h3 Not In Good Standing
|
2
|
+
= f.check_box :create_not_in_good_standing, label: 'Yes, Not in Good Standing status should be applied'
|
3
|
+
|
4
|
+
= f.show_if(:create_not_in_good_standing, true) do
|
5
|
+
- period = EffectiveMemberships.Registrar.current_period
|
6
|
+
- date = EffectiveMemberships.Registrar.not_in_good_standing_date(period: period)
|
7
|
+
|
8
|
+
%p Members with outstanding fees, on #{date.strftime('%B %e')}, will automatically be marked #{badge('Not In Good Standing')}.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%h3 Renewal Fees
|
2
|
+
= f.check_box :create_renewal_fees, label: 'Yes, annual renewal fees should be created'
|
3
|
+
|
4
|
+
= f.show_if(:create_renewal_fees, true) do
|
5
|
+
- date = EffectiveMemberships.Registrar.renewal_fee_date(date: Time.zone.now)
|
6
|
+
|
7
|
+
%p Charged to members, every #{date.strftime('%B %e')}, to renew their dues.
|
8
|
+
.row
|
9
|
+
.col-3= f.price_field :renewal_fee
|
@@ -1,56 +1,7 @@
|
|
1
1
|
= effective_form_with(model: [:admin, category], engine: true) do |f|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
%h3 Pro-rated fees based on date of approval
|
8
|
-
.row
|
9
|
-
.col-lg-3
|
10
|
-
= f.price_field :prorated_jan, label: "January"
|
11
|
-
= f.price_field :prorated_feb, label: "February"
|
12
|
-
= f.price_field :prorated_mar, label: "March"
|
13
|
-
.col-lg-3
|
14
|
-
= f.price_field :prorated_apr, label: "April"
|
15
|
-
= f.price_field :prorated_may, label: "May"
|
16
|
-
= f.price_field :prorated_jun, label: "June"
|
17
|
-
.col-lg-3
|
18
|
-
= f.price_field :prorated_jul, label: "July"
|
19
|
-
= f.price_field :prorated_aug, label: "August"
|
20
|
-
= f.price_field :prorated_sep, label: "September"
|
21
|
-
.col-lg-3
|
22
|
-
= f.price_field :prorated_oct, label: "October"
|
23
|
-
= f.price_field :prorated_nov, label: "November"
|
24
|
-
= f.price_field :prorated_dec, label: "December"
|
25
|
-
|
26
|
-
%h3 Renewal Fees
|
27
|
-
= f.check_box :create_renewal_fees, label: 'Yes, annual renewal fees should be created'
|
28
|
-
|
29
|
-
= f.show_if(:create_renewal_fees, true) do
|
30
|
-
- date = EffectiveMemberships.Registrar.renewal_fee_date(date: Time.zone.now)
|
31
|
-
|
32
|
-
%p Charged to members, every #{date.strftime('%B %e')}, to renew their dues.
|
33
|
-
.row
|
34
|
-
.col-3= f.price_field :renewal_fee
|
35
|
-
|
36
|
-
%h3 Late Fees
|
37
|
-
= f.check_box :create_late_fees, label: 'Yes, late fees should be created'
|
38
|
-
|
39
|
-
= f.show_if(:create_late_fees, true) do
|
40
|
-
- period = EffectiveMemberships.Registrar.current_period
|
41
|
-
- date = EffectiveMemberships.Registrar.late_fee_date(period: period)
|
42
|
-
|
43
|
-
%p Charged to members, on #{date.strftime('%B %e')}, with outstanding renewal fees
|
44
|
-
.row
|
45
|
-
.col-3= f.price_field :late_fee
|
46
|
-
|
47
|
-
%h3 Bad Standing
|
48
|
-
= f.check_box :create_not_in_good_standing, label: 'Yes, Not in Good Standing status should be applied'
|
49
|
-
|
50
|
-
= f.show_if(:create_not_in_good_standing, true) do
|
51
|
-
- period = EffectiveMemberships.Registrar.current_period
|
52
|
-
- date = EffectiveMemberships.Registrar.not_in_good_standing_date(period: period)
|
53
|
-
|
54
|
-
%p Members with outstanding fees, on #{date.strftime('%B %e')}, will automatically be marked #{badge('Not In Good Standing')}.
|
55
|
-
|
2
|
+
= render('admin/categories/fees_applicant', f: f)
|
3
|
+
= render('admin/categories/fees_renewal', f: f)
|
4
|
+
= render('admin/categories/fees_late', f: f)
|
5
|
+
= render('admin/categories/fees_additional', f: f)
|
6
|
+
= render('admin/categories/fees_nigs', f: f)
|
56
7
|
= f.submit
|
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.12.
|
4
|
+
version: 0.12.3
|
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-03-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -363,6 +363,11 @@ files:
|
|
363
363
|
- app/views/admin/applicants/_form_process.html.haml
|
364
364
|
- app/views/admin/applicants/_form_transcripts.html.haml
|
365
365
|
- app/views/admin/applicants/_status.html.haml
|
366
|
+
- app/views/admin/categories/_fees_additional.html.haml
|
367
|
+
- app/views/admin/categories/_fees_applicant.html.haml
|
368
|
+
- app/views/admin/categories/_fees_late.html.haml
|
369
|
+
- app/views/admin/categories/_fees_nigs.html.haml
|
370
|
+
- app/views/admin/categories/_fees_renewal.html.haml
|
366
371
|
- app/views/admin/categories/_form.html.haml
|
367
372
|
- app/views/admin/categories/_form_applicant_content.html.haml
|
368
373
|
- app/views/admin/categories/_form_applicant_steps.html.haml
|