effective_memberships 0.17.1 → 0.17.3

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: 75a253a5d3a571ffd68882f95735ce2461498cb40900064fd66e60026db9ce67
4
- data.tar.gz: 83336209575eb783851494cf7b5edb7c98c3a29bbe4abc2403600581b83a6214
3
+ metadata.gz: 172faa35356355bd3a8d6f2bd51a4d1ec26cac9b58c617713b972096c32ec42d
4
+ data.tar.gz: fa370c75fcf09fd03134451dc3ffeefb3bd3b0b9032392fb4e9a17c364f810a0
5
5
  SHA512:
6
- metadata.gz: 40ae6507569b2b58eb60b54be06033204b3eaadb9476438bf16b4683b5710627674778737b774e5db843c485be3d3df746151b0f2a0e1951efeb03a03f43fbe5
7
- data.tar.gz: 264eae8dc5ac8b7666a627ed1706ac37bfbdc7439aa7004d4ac3bb9def1849df957ae198c838bfede8d40b721398a8592154d0a36e2d0e0762a0e4d5de0bf5b6
6
+ metadata.gz: 1853d32c2a951cc21b34ee224007bed5ca1af849027f3ac398cd99a77c9397e4cc8cce59ba7e26c23ffd4cb006676933a7a208a95b2c55a9f3b48ff0b6218db8
7
+ data.tar.gz: a5a8f725ca25361aa8424108fc59c4aff507367a895c0f99f94ecdbce30117a6d77049facf8ba255fdacef68a555c5c87172f8c72ca1bc1304f4183fe66362f2
@@ -36,6 +36,7 @@ module Admin
36
36
  col :from_category, search: { collection: EffectiveMemberships.Category.all, polymorphic: false }
37
37
  col :from_status, search: { collection: EffectiveMemberships.Status.all, polymorphic: false }
38
38
 
39
+ col :applicant_reviews, visible: false
39
40
  col :orders, visible: false
40
41
 
41
42
  actions_col
@@ -102,9 +102,14 @@ module EffectiveMembershipsApplicantReview
102
102
 
103
103
  def submit!
104
104
  submitted!
105
- applicant.try_reviewed!
106
105
 
107
- after_commit { send_email(:applicant_review_submitted) }
106
+ after_commit do
107
+ applicant.reload
108
+ applicant.try_reviewed!
109
+
110
+ send_email(:applicant_review_submitted)
111
+ end
112
+
108
113
  true
109
114
  end
110
115
 
@@ -48,6 +48,7 @@ module EffectiveMembershipsFeePayment
48
48
 
49
49
  # CPD Step
50
50
  attr_accessor :declare_cpd
51
+ attr_accessor :skip_cpd_validation
51
52
 
52
53
  # Declarations Step
53
54
  attr_accessor :declare_code_of_ethics
@@ -127,11 +128,11 @@ module EffectiveMembershipsFeePayment
127
128
  # CPD step
128
129
  with_options(if: -> { current_step == :cpd }) do
129
130
  validates :declare_cpd, acceptance: true
131
+ end
130
132
 
131
- validate do
132
- if (cpd_cycles = cpd_uncompleted_cpd_cycles).present?
133
- self.errors.add(:base, "Please complete #{cpd_cycles.map(&:to_s).to_sentence} to continue")
134
- end
133
+ validate(if: -> { current_step == :cpd && !skip_cpd_validation }) do
134
+ if (cpd_cycles = cpd_uncompleted_cpd_cycles).present?
135
+ self.errors.add(:base, "Please complete #{cpd_cycles.map(&:to_s).to_sentence} to continue")
135
136
  end
136
137
  end
137
138
 
@@ -172,6 +173,11 @@ module EffectiveMembershipsFeePayment
172
173
  end
173
174
  end
174
175
 
176
+ def can_visit_step?(step)
177
+ return (step == :submitted) if was_submitted?
178
+ can_revisit_completed_steps(step)
179
+ end
180
+
175
181
  # All Fees and Orders
176
182
  # Overriding acts_as_purchasable_wizard
177
183
  def submit_fees
@@ -246,12 +252,30 @@ module EffectiveMembershipsFeePayment
246
252
  end
247
253
 
248
254
  def cpd_required_cpd_cycles
249
- date = submitted_at || Time.zone.now
255
+ @cpd_required_cpd_cycles ||= begin
256
+ date = submitted_at || Time.zone.now
257
+
258
+ cpd_cycles = [] # Return value
259
+
260
+ # The current and previous cycle
261
+ current = EffectiveCpd.current_cpd_cycle(date: date)
262
+ previous = EffectiveCpd.previous_cpd_cycle(date: date)
250
263
 
251
- [
252
- (EffectiveCpd.previous_cpd_cycle(date: date) if cpd_requirement.to_s.include?('previous')),
253
- (EffectiveCpd.current_cpd_cycle(date: date) if cpd_requirement.to_s.include?('current'))
254
- ].compact
264
+ if current.present? && cpd_requirement.to_s.include?('current')
265
+ cpd_cycles << current
266
+ end
267
+
268
+ # Only include if they were a member during the previous period
269
+ if previous.present? && cpd_requirement.to_s.include?('previous')
270
+ period = EffectiveMemberships.Registrar.period(date: previous.end_at&.advance(months: -1) || current&.start_at&.advance(months: -1) || previous.start_at.advance(months: 1))
271
+ renewal_date = EffectiveMemberships.Registrar.renewal_fee_date(date: period)
272
+ membership_history = owner.membership_history_on(renewal_date.advance(days: -1))
273
+
274
+ cpd_cycles << previous if membership_history.present? && !membership_history.removed?
275
+ end
276
+
277
+ cpd_cycles
278
+ end
255
279
  end
256
280
 
257
281
  def cpd_completed_cpd_cycles
@@ -4,12 +4,12 @@
4
4
  = card(et('effective_cpd.name')) do
5
5
  = render('cpd_requirements', applicant: resource)
6
6
 
7
- = card('All ' + cpd_statements_label) do
8
- = render('effective/wizard_steps/cpd_statements', resource: resource)
9
-
10
7
  = card('Requirements') do
11
8
  = render('effective/wizard_steps/cpd_requirements', resource: resource)
12
9
 
10
+ = card('All ' + cpd_statements_label) do
11
+ = render('effective/wizard_steps/cpd_statements', resource: resource)
12
+
13
13
  = card do
14
14
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
15
15
  = f.hidden_field :id
@@ -1,3 +1,3 @@
1
1
  = wizard_card(fee_payment) do
2
- = render('effective/wizard_steps/cpd_statements', resource: fee_payment)
3
2
  = render('effective/wizard_steps/cpd_requirements', resource: fee_payment)
3
+ = render('effective/wizard_steps/cpd_statements', resource: fee_payment)
@@ -4,12 +4,12 @@
4
4
  = card(et('effective_cpd.name')) do
5
5
  = render('cpd_requirements', fee_payment: resource)
6
6
 
7
- = card('All ' + cpd_statements_label) do
8
- = render('effective/wizard_steps/cpd_statements', resource: resource)
9
-
10
7
  = card('Requirements') do
11
8
  = render('effective/wizard_steps/cpd_requirements', resource: resource)
12
9
 
10
+ = card('All ' + cpd_statements_label) do
11
+ = render('effective/wizard_steps/cpd_statements', resource: resource)
12
+
13
13
  = card do
14
14
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
15
15
  = f.hidden_field :id
@@ -17,4 +17,7 @@
17
17
  - f.object.declare_cpd = true if f.object.has_completed_step?(:cpd)
18
18
  = render('effective/wizard_steps/cpd_fields', f: f)
19
19
 
20
+ - if Rails.env.development? || Rails.env.test?
21
+ = f.check_box :skip_cpd_validation, label: "Yes, skip the :cpd step validation (development and test mode only)"
22
+
20
23
  = f.save 'Save and Continue'
@@ -1,3 +1,3 @@
1
1
  module EffectiveMemberships
2
- VERSION = '0.17.1'
2
+ VERSION = '0.17.3'
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.17.1
4
+ version: 0.17.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-05-02 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -574,7 +574,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
574
574
  - !ruby/object:Gem::Version
575
575
  version: '0'
576
576
  requirements: []
577
- rubygems_version: 3.1.2
577
+ rubygems_version: 3.0.8
578
578
  signing_key:
579
579
  specification_version: 4
580
580
  summary: Manage your professional association online. Membership categories, applications