effective_memberships 0.17.7 → 0.17.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/admin/effective_memberships_datatable.rb +7 -1
- data/app/models/concerns/effective_memberships_applicant.rb +17 -0
- data/app/models/concerns/effective_memberships_category.rb +4 -0
- data/app/models/concerns/effective_memberships_owner.rb +46 -0
- data/app/models/concerns/effective_memberships_status.rb +2 -3
- data/app/models/effective/membership_history.rb +3 -0
- data/app/views/admin/memberships/_form_membership.html.haml +2 -0
- data/app/views/effective/memberships/_dashboard.html.haml +4 -1
- data/app/views/effective/memberships/_reclassification.html.haml +14 -0
- data/app/views/effective/memberships/_reinstatement.html.haml +14 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02b881930550198b6c2e18381683543910d16534b7766768661eb4f91cf96214
|
4
|
+
data.tar.gz: e30e3b80c39e484178561cd7aba32e4157c735d831afb80ca16758ca748c9479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95040d97dfc5aadc8816a2fb6cc2111336306df360a05622386a9db87848a12921449970c9f8f63b5a4ffdd5e54b6a5cced0b7c4cef59e188c850f6ded76dc59
|
7
|
+
data.tar.gz: 15fc30fe1419f2c9443e19d07620b63180195995472b5fb86040ac4d1e46eadc906ff07b70fb3356b1c42ace9870e523c3afaf0cbd62b41724208e22e1b1c3c4
|
@@ -64,7 +64,13 @@ module Admin
|
|
64
64
|
membership.owner.try(:addresses).try(:first).try(:postal_code)
|
65
65
|
end
|
66
66
|
|
67
|
-
actions_col
|
67
|
+
actions_col do |membership|
|
68
|
+
if membership.owner_type.include?('Organization')
|
69
|
+
dropdown_link_to 'Show', "/admin/organizations/#{membership.owner.to_param}/edit#tab-membership", 'data-turbolinks': false
|
70
|
+
elsif membership.owner_type.include?('User')
|
71
|
+
dropdown_link_to 'Show', "/admin/users/#{membership.owner.to_param}/edit#tab-membership", 'data-turbolinks': false
|
72
|
+
end
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
collection do
|
@@ -251,6 +251,23 @@ module EffectiveMembershipsApplicant
|
|
251
251
|
validates :category, presence: true
|
252
252
|
end
|
253
253
|
|
254
|
+
# Select Step - Check for expired reclassification or reinstatement dates
|
255
|
+
validate(if: -> { current_step == :select && owner.present? && applicant_type.present? && category.present? }) do
|
256
|
+
# Dates
|
257
|
+
today = (created_at || Time.zone.now).beginning_of_day
|
258
|
+
|
259
|
+
reclassification_expires_on = owner.reclassification_expires_on(from: from_category, to: category)
|
260
|
+
reinstatement_expires_on = owner.reinstatement_expires_on(from: from_status)
|
261
|
+
|
262
|
+
if reclassification? && reclassification_expires_on.present? && reclassification_expires_on <= today
|
263
|
+
errors.add(:base, "Your ability to apply for reclassification expired on #{reclassification_expires_on.strftime('%F')}. Please contact us for assistance.")
|
264
|
+
end
|
265
|
+
|
266
|
+
if reinstatement? && reinstatement_expires_on.present? && reinstatement_expires_on <= today
|
267
|
+
errors.add(:base, "Your ability to apply for reinstatement expired on #{reinstatement_expires_on.strftime('%F')}. Please contact us for assistance.")
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
254
271
|
# They can checkout with outstanding fees
|
255
272
|
# validate(if: -> { current_step == :select && owner.present? }) do
|
256
273
|
# self.errors.add(:base, 'may not have outstanding fees') if owner.outstanding_fee_payment_fees.present?
|
@@ -137,6 +137,44 @@ module EffectiveMembershipsOwner
|
|
137
137
|
removed_membership_history.start_on if membership_removed?
|
138
138
|
end
|
139
139
|
|
140
|
+
# Checked by the applicant on the select step
|
141
|
+
def reclassification_expires_on(from: nil, to: nil)
|
142
|
+
return unless membership.present?
|
143
|
+
|
144
|
+
# User/owner might respond to this
|
145
|
+
date = try(:admin_reclassification_expires_on)
|
146
|
+
return date if date.present?
|
147
|
+
|
148
|
+
# When we last reclassified to our current category
|
149
|
+
history = last_membership_history(category: membership.membership_categories.first)
|
150
|
+
reclassified_on = (history&.start_on || membership.registration_on || membership.joined_on)
|
151
|
+
|
152
|
+
# Otherwise consider the membership categories
|
153
|
+
expires_on = membership.categories.select { |category| category.reclassification_expires_in.present? }.map do |category|
|
154
|
+
reclassified_on + category.reclassification_expires_in
|
155
|
+
end.min
|
156
|
+
|
157
|
+
expires_on
|
158
|
+
end
|
159
|
+
|
160
|
+
def reinstatement_expires_on(from: nil)
|
161
|
+
return unless membership_removed?
|
162
|
+
|
163
|
+
# User/owner might respond to this
|
164
|
+
date = try(:admin_reinstatement_expires_on)
|
165
|
+
return date if date.present?
|
166
|
+
|
167
|
+
# When we were removed
|
168
|
+
removed_on = removed_membership_history.start_on
|
169
|
+
|
170
|
+
# Consider any membership statuses that have reinstatement expires in
|
171
|
+
expires_on = removed_membership_history.membership_statuses.select { |status| status.reinstatement_expires_in.present? }.map do |status|
|
172
|
+
removed_on + status.reinstatement_expires_in
|
173
|
+
end.min
|
174
|
+
|
175
|
+
expires_on
|
176
|
+
end
|
177
|
+
|
140
178
|
# The membership history that is removed. Has exit statuses that may affect reinstatement fees.
|
141
179
|
def removed_membership_history
|
142
180
|
membership_histories.reverse.find { |history| history.removed? } if membership_removed?
|
@@ -444,6 +482,14 @@ module EffectiveMembershipsOwner
|
|
444
482
|
membership_histories.find { |history| (history.start_on..history.end_on).cover?(date) } # Ruby 2.6 supports endless ranges
|
445
483
|
end
|
446
484
|
|
485
|
+
def first_membership_history(category: nil)
|
486
|
+
membership_histories.find { |history| category.blank? || history.membership_category_ids.include?(category.id) }
|
487
|
+
end
|
488
|
+
|
489
|
+
def last_membership_history(category: nil)
|
490
|
+
membership_histories.reverse.find { |history| category.blank? || history.membership_category_ids.include?(category.id) }
|
491
|
+
end
|
492
|
+
|
447
493
|
# Point out busted data
|
448
494
|
def membership_history_errors
|
449
495
|
return unless membership.present?
|
@@ -9,6 +9,8 @@
|
|
9
9
|
|
10
10
|
= f.static_field :current_action, label: 'Current Membership' do
|
11
11
|
= membership.to_s
|
12
|
+
= render('effective/memberships/reclassification', user: membership.owner)
|
13
|
+
= render('effective/memberships/reinstatement', user: membership.owner)
|
12
14
|
|
13
15
|
= f.check_box :current_action, label: 'Yes, update membership information'
|
14
16
|
|
@@ -33,11 +33,14 @@
|
|
33
33
|
- if membership.not_in_good_standing?
|
34
34
|
%p Your membership is Not In Good Standing because of unpurchased fees or dues. Please purchase these dues or contact us.
|
35
35
|
|
36
|
+
- if membership.present?
|
37
|
+
= render('effective/memberships/reclassification', user: current_user)
|
38
|
+
|
36
39
|
- if current_user.membership_removed?
|
37
40
|
%p Your membership was removed on #{current_user.membership_removed_on.strftime('%F')}.
|
38
41
|
|
39
42
|
- if current_user.reinstatement_membership_history.present?
|
40
|
-
|
43
|
+
= render('effective/memberships/reinstatement', user: current_user)
|
41
44
|
|
42
45
|
- if membership_organizations.present?
|
43
46
|
%p You are a representative for #{pluralize(membership_organizations.length, 'member organization')}.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- if user.membership.present?
|
2
|
+
- now = Time.zone.now.beginning_of_day
|
3
|
+
- applicants = user.applicants.select { |applicant| applicant.in_progress? }
|
4
|
+
|
5
|
+
- if applicants.blank?
|
6
|
+
- expires_on = user.reclassification_expires_on
|
7
|
+
- category = user.membership.categories.to_sentence
|
8
|
+
|
9
|
+
- if expires_on.blank?
|
10
|
+
- # Nothing to do
|
11
|
+
- elsif now < expires_on
|
12
|
+
%p You have until #{expires_on.strftime('%F')}, #{distance_of_time_in_words(now, expires_on)} from now, to Apply for Reclassification from #{category}.
|
13
|
+
- else
|
14
|
+
%p Your ability to Apply for Reclassification from #{category} expired on #{expires_on.strftime('%F')}.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- if user.reinstatement_membership_history.present?
|
2
|
+
- now = Time.zone.now.beginning_of_day
|
3
|
+
- applicants = user.applicants.select { |applicant| applicant.in_progress? }
|
4
|
+
|
5
|
+
- if applicants.blank?
|
6
|
+
- category = user.reinstatement_membership_category
|
7
|
+
- expires_on = user.reinstatement_expires_on
|
8
|
+
|
9
|
+
- if expires_on.blank?
|
10
|
+
- # Nothing to do
|
11
|
+
- elsif now < expires_on
|
12
|
+
%p You have until #{expires_on.strftime('%F')}, #{distance_of_time_in_words(now, expires_on)} from now, to Apply for Reinstatement to #{category}.
|
13
|
+
- else
|
14
|
+
%p Your ability to Apply for Reinstatement to #{category} expired on #{expires_on.strftime('%F')}.
|
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.17.
|
4
|
+
version: 0.17.8
|
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-05-
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -525,6 +525,8 @@ files:
|
|
525
525
|
- app/views/effective/membership_directory/show.html.haml
|
526
526
|
- app/views/effective/memberships/_dashboard.html.haml
|
527
527
|
- app/views/effective/memberships/_membership.html.haml
|
528
|
+
- app/views/effective/memberships/_reclassification.html.haml
|
529
|
+
- app/views/effective/memberships/_reinstatement.html.haml
|
528
530
|
- app/views/effective/memberships_mailer/applicant_approved.liquid
|
529
531
|
- app/views/effective/memberships_mailer/applicant_completed.liquid
|
530
532
|
- app/views/effective/memberships_mailer/applicant_declined.liquid
|