effective_memberships 0.2.4 → 0.3.1
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.
- checksums.yaml +4 -4
- data/app/controllers/effective/applicants_controller.rb +0 -24
- data/app/controllers/effective/fee_payments_controller.rb +0 -22
- data/app/models/concerns/effective_memberships_applicant.rb +16 -12
- data/app/models/concerns/effective_memberships_applicant_review.rb +9 -6
- data/app/models/effective/applicant_course.rb +2 -2
- data/app/models/effective/applicant_education.rb +2 -2
- data/app/models/effective/applicant_experience.rb +2 -2
- data/app/models/effective/applicant_reference.rb +2 -2
- data/db/migrate/01_create_effective_memberships.rb.erb +7 -0
- data/lib/effective_memberships/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 259907d1e85043159bf1f3000ee1d6b9d856b422b8cc8e6164045c5a7513142a
|
4
|
+
data.tar.gz: f0f0b98543ee1e1cbd20ea53749a9ca2d479798d7374ee992815af8d9b2800e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4b7d38ee4af24942eed3d80c66cb62ba47850616b620cd24351ff9f860bcc3ef4ee3fa66e3d54a128790694c2c85798fa57282602b24914fc4df7810d8785dd
|
7
|
+
data.tar.gz: 18111c8718b33ca1253ee82b706195cc5cccde005ca07a5f102c30c6588e1bbb6dde7a7387037ba888b4d516ec15e41e0845257ddaa1635fcd329aafb090491a
|
@@ -6,29 +6,5 @@ module Effective
|
|
6
6
|
|
7
7
|
resource_scope -> { EffectiveMemberships.Applicant.deep.where(owner: current_user.effective_memberships_owners) }
|
8
8
|
|
9
|
-
# Allow only 1 in-progress application at a time
|
10
|
-
before_action(only: [:new, :show], unless: -> { resource&.done? }) do
|
11
|
-
existing = resource_scope.in_progress.where.not(id: resource).first
|
12
|
-
|
13
|
-
if existing.present?
|
14
|
-
flash[:success] = "You have been redirected to your existing in progress application"
|
15
|
-
redirect_to effective_memberships.applicant_build_path(existing, existing.next_step)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
after_save do
|
20
|
-
flash.now[:success] = ''
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def permitted_params
|
26
|
-
params.require(:applicant).permit!.except(
|
27
|
-
:owner_id, :owner_type, :status, :status_steps, :wizard_steps,
|
28
|
-
:submitted_at, :completed_at, :reviewed_at, :approved_at,
|
29
|
-
:declined_at, :declined_reason, :created_at, :updated_at
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
9
|
end
|
34
10
|
end
|
@@ -6,27 +6,5 @@ module Effective
|
|
6
6
|
|
7
7
|
resource_scope -> { EffectiveMemberships.FeePayment.deep.where(owner: current_user.effective_memberships_owners) }
|
8
8
|
|
9
|
-
# Allow only 1 in-progress fee payment at a time
|
10
|
-
before_action(only: [:new, :show], unless: -> { resource&.done? }) do
|
11
|
-
existing = resource_scope.in_progress.where.not(id: resource).first
|
12
|
-
|
13
|
-
if existing.present?
|
14
|
-
flash[:success] = "You have been redirected to your existing in progress fee payment"
|
15
|
-
redirect_to effective_memberships.fee_payment_build_path(existing, existing.next_step)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
after_save do
|
20
|
-
flash.now[:success] = ''
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def permitted_params
|
26
|
-
params.require(:fee_payment).permit!.except(
|
27
|
-
:status, :status_steps, :wizard_steps, :submitted_at
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
9
|
end
|
32
10
|
end
|
@@ -77,20 +77,20 @@ module EffectiveMembershipsApplicant
|
|
77
77
|
belongs_to :category, polymorphic: true, optional: true
|
78
78
|
belongs_to :from_category, polymorphic: true, optional: true
|
79
79
|
|
80
|
-
has_many :applicant_reviews, -> { order(:id) },
|
80
|
+
has_many :applicant_reviews, -> { order(:id) }, as: :applicant, dependent: :destroy
|
81
81
|
accepts_nested_attributes_for :applicant_reviews, reject_if: :all_blank, allow_destroy: true
|
82
82
|
|
83
83
|
# Effective Namespace
|
84
|
-
has_many :applicant_courses, -> { order(:id) }, class_name: 'Effective::ApplicantCourse',
|
84
|
+
has_many :applicant_courses, -> { order(:id) }, class_name: 'Effective::ApplicantCourse', as: :applicant, dependent: :destroy
|
85
85
|
accepts_nested_attributes_for :applicant_courses, reject_if: :all_blank, allow_destroy: true
|
86
86
|
|
87
|
-
has_many :applicant_educations, -> { order(:id) }, class_name: 'Effective::ApplicantEducation',
|
87
|
+
has_many :applicant_educations, -> { order(:id) }, class_name: 'Effective::ApplicantEducation', as: :applicant, dependent: :destroy
|
88
88
|
accepts_nested_attributes_for :applicant_educations, reject_if: :all_blank, allow_destroy: true
|
89
89
|
|
90
|
-
has_many :applicant_experiences, -> { order(:id) }, class_name: 'Effective::ApplicantExperience',
|
90
|
+
has_many :applicant_experiences, -> { order(:id) }, class_name: 'Effective::ApplicantExperience', as: :applicant, dependent: :destroy
|
91
91
|
accepts_nested_attributes_for :applicant_experiences, reject_if: :all_blank, allow_destroy: true
|
92
92
|
|
93
|
-
has_many :applicant_references, -> { order(:id) }, class_name: 'Effective::ApplicantReference',
|
93
|
+
has_many :applicant_references, -> { order(:id) }, class_name: 'Effective::ApplicantReference', as: :applicant, dependent: :destroy
|
94
94
|
accepts_nested_attributes_for :applicant_references, reject_if: :all_blank, allow_destroy: true
|
95
95
|
|
96
96
|
has_many :fees, -> { order(:id) }, as: :parent, class_name: 'Effective::Fee', dependent: :nullify
|
@@ -312,13 +312,15 @@ module EffectiveMembershipsApplicant
|
|
312
312
|
raise('already submitted') if was_submitted?
|
313
313
|
raise('expected a purchased order') unless submit_order&.purchased?
|
314
314
|
|
315
|
+
wizard_steps[:checkout] ||= Time.zone.now
|
316
|
+
wizard_steps[:submitted] = Time.zone.now
|
317
|
+
submitted!
|
318
|
+
|
315
319
|
after_commit do
|
316
320
|
applicant_references.each { |reference| reference.notify! if reference.submitted? }
|
317
321
|
end
|
318
322
|
|
319
|
-
|
320
|
-
wizard_steps[:submitted] = Time.zone.now
|
321
|
-
submitted!
|
323
|
+
true
|
322
324
|
end
|
323
325
|
|
324
326
|
end
|
@@ -526,9 +528,10 @@ module EffectiveMembershipsApplicant
|
|
526
528
|
raise('unsupported approval applicant_type')
|
527
529
|
end
|
528
530
|
|
529
|
-
after_commit { send_email(:applicant_approved) }
|
530
|
-
|
531
531
|
save!
|
532
|
+
|
533
|
+
after_commit { send_email(:applicant_approved) }
|
534
|
+
true
|
532
535
|
end
|
533
536
|
|
534
537
|
# Admin approves an applicant. Registers the owner. Sends an email.
|
@@ -542,9 +545,10 @@ module EffectiveMembershipsApplicant
|
|
542
545
|
wizard_steps[:submitted] ||= Time.zone.now
|
543
546
|
declined!
|
544
547
|
|
545
|
-
after_commit { send_email(:applicant_declined) }
|
546
|
-
|
547
548
|
save!
|
549
|
+
|
550
|
+
after_commit { send_email(:applicant_declined) }
|
551
|
+
true
|
548
552
|
end
|
549
553
|
|
550
554
|
private
|
@@ -109,30 +109,33 @@ module EffectiveMembershipsApplicantReview
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def conflict_of_interest!
|
112
|
-
after_commit { send_email(:applicant_review_conflict_of_interest) }
|
113
|
-
|
114
112
|
update!(conflict_of_interest: true, recommendation: nil)
|
115
113
|
conflicted!
|
116
114
|
|
117
115
|
applicant.save!
|
116
|
+
|
117
|
+
after_commit { send_email(:applicant_review_conflict_of_interest) }
|
118
|
+
true
|
118
119
|
end
|
119
120
|
|
120
121
|
def accept!
|
121
|
-
after_commit { send_email(:applicant_review_completed) }
|
122
|
-
|
123
122
|
assign_attributes(recommendation: 'Accept')
|
124
123
|
accepted!
|
125
124
|
|
126
125
|
applicant.save!
|
127
|
-
end
|
128
126
|
|
129
|
-
def reject!
|
130
127
|
after_commit { send_email(:applicant_review_completed) }
|
128
|
+
true
|
129
|
+
end
|
131
130
|
|
131
|
+
def reject!
|
132
132
|
assign_attributes(recommendation: 'Reject')
|
133
133
|
rejected!
|
134
134
|
|
135
135
|
applicant.save!
|
136
|
+
|
137
|
+
after_commit { send_email(:applicant_review_completed) }
|
138
|
+
true
|
136
139
|
end
|
137
140
|
|
138
141
|
private
|
@@ -4,8 +4,8 @@ module Effective
|
|
4
4
|
|
5
5
|
belongs_to :applicant_course_area
|
6
6
|
|
7
|
+
belongs_to :applicant, polymorphic: true, optional: true
|
7
8
|
belongs_to :applicant_course_name, optional: true
|
8
|
-
belongs_to :applicant, optional: true
|
9
9
|
|
10
10
|
effective_resource do
|
11
11
|
title :string
|
@@ -17,7 +17,7 @@ module Effective
|
|
17
17
|
timestamps
|
18
18
|
end
|
19
19
|
|
20
|
-
scope :deep, -> { includes(:applicant_course_area, :applicant_course_name
|
20
|
+
scope :deep, -> { includes(:applicant_course_area, :applicant_course_name) }
|
21
21
|
scope :sorted, -> { order(:title) }
|
22
22
|
|
23
23
|
before_validation(if: -> { applicant_course_name.present? }) do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class ApplicantEducation < ActiveRecord::Base
|
3
|
-
belongs_to :applicant
|
3
|
+
belongs_to :applicant, polymorphic: true
|
4
4
|
|
5
5
|
log_changes(to: :applicant) if respond_to?(:log_changes)
|
6
6
|
|
@@ -16,7 +16,7 @@ module Effective
|
|
16
16
|
timestamps
|
17
17
|
end
|
18
18
|
|
19
|
-
scope :deep, -> {
|
19
|
+
scope :deep, -> { all }
|
20
20
|
|
21
21
|
validates :start_on, presence: true
|
22
22
|
validates :end_on, presence: true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class ApplicantExperience < ActiveRecord::Base
|
3
|
-
belongs_to :applicant
|
3
|
+
belongs_to :applicant, polymorphic: true
|
4
4
|
|
5
5
|
log_changes(to: :applicant) if respond_to?(:log_changes)
|
6
6
|
|
@@ -25,7 +25,7 @@ module Effective
|
|
25
25
|
timestamps
|
26
26
|
end
|
27
27
|
|
28
|
-
scope :deep, -> {
|
28
|
+
scope :deep, -> { all }
|
29
29
|
|
30
30
|
before_validation(if: -> { start_on.present? && end_on.present? }) do
|
31
31
|
self.months ||= ((end_on - start_on) / 1.month).to_i
|
@@ -5,7 +5,7 @@ module Effective
|
|
5
5
|
acts_as_statused :submitted, :completed
|
6
6
|
log_changes(to: :applicant) if respond_to?(:log_changes)
|
7
7
|
|
8
|
-
belongs_to :applicant
|
8
|
+
belongs_to :applicant, polymorphic: true
|
9
9
|
|
10
10
|
KNOWNS = ['6 months - 1 year', '1 year - 2 years', '2 - 5 years', '5 - 10 years', 'More than 10 years']
|
11
11
|
RELATIONSHIPS = ['Supervisor', 'Employer', 'Colleague', 'Other']
|
@@ -38,7 +38,7 @@ module Effective
|
|
38
38
|
timestamps
|
39
39
|
end
|
40
40
|
|
41
|
-
scope :deep, -> {
|
41
|
+
scope :deep, -> { all }
|
42
42
|
|
43
43
|
# All step validations
|
44
44
|
validates :applicant, presence: true
|
@@ -172,6 +172,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
172
172
|
# Applicant Educations
|
173
173
|
create_table :applicant_educations do |t|
|
174
174
|
t.integer :applicant_id
|
175
|
+
t.string :applicant_type
|
175
176
|
|
176
177
|
t.date :start_on
|
177
178
|
t.date :end_on
|
@@ -191,6 +192,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
191
192
|
# Applicant Experiences
|
192
193
|
create_table :applicant_experiences do |t|
|
193
194
|
t.integer :applicant_id
|
195
|
+
t.string :applicant_type
|
194
196
|
|
195
197
|
t.string :level
|
196
198
|
t.integer :months
|
@@ -216,6 +218,7 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
216
218
|
# Applicant References
|
217
219
|
create_table :applicant_references do |t|
|
218
220
|
t.integer :applicant_id
|
221
|
+
t.string :applicant_type
|
219
222
|
|
220
223
|
t.string :name
|
221
224
|
t.string :email
|
@@ -264,7 +267,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
264
267
|
create_table :applicant_courses do |t|
|
265
268
|
t.integer :applicant_course_area_id
|
266
269
|
t.integer :applicant_course_name_id
|
270
|
+
|
267
271
|
t.integer :applicant_id
|
272
|
+
t.string :applicant_type
|
268
273
|
|
269
274
|
t.string :title
|
270
275
|
t.integer :amount
|
@@ -279,7 +284,9 @@ class CreateEffectiveMemberships < ActiveRecord::Migration[6.0]
|
|
279
284
|
# Applicant Reviews
|
280
285
|
create_table :applicant_reviews do |t|
|
281
286
|
t.string :token
|
287
|
+
|
282
288
|
t.integer :applicant_id
|
289
|
+
t.string :applicant_type
|
283
290
|
|
284
291
|
t.integer :reviewer_id
|
285
292
|
t.string :reviewer_type
|
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.
|
4
|
+
version: 0.3.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: 2022-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|