effective_cpd 1.2.1 → 1.2.2
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/admin/cpd_audits_controller.rb +7 -0
- data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +1 -1
- data/app/helpers/effective_cpd_audits_helper.rb +18 -0
- data/app/models/concerns/effective_cpd_audit.rb +9 -3
- data/app/models/concerns/effective_cpd_audit_review.rb +4 -1
- data/app/models/concerns/effective_cpd_user.rb +10 -0
- data/app/models/effective/cpd_audit_response_option.rb +5 -0
- data/app/views/admin/cpd_audit_reviews/_form.html.haml +4 -1
- data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +2 -2
- data/app/views/admin/cpd_audits/_form_close.html.haml +1 -1
- data/app/views/admin/cpd_audits/_form_complete.html.haml +25 -9
- data/app/views/admin/cpd_audits/_form_deadlines.html.haml +3 -3
- data/app/views/admin/cpd_audits/_form_new.html.haml +2 -0
- data/app/views/admin/cpd_audits/_form_new_fields.html.haml +1 -0
- data/app/views/admin/cpd_audits/_form_process.html.haml +2 -2
- data/app/views/admin/cpd_audits/_status.html.haml +8 -3
- data/app/views/effective/cpd_audit_review_items/_fields.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +6 -2
- data/app/views/effective/cpd_audit_reviews/conflict.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/feedback.html.haml +2 -2
- data/app/views/effective/cpd_audit_reviews/files.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/instructions.html.haml +2 -2
- data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/statements.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
- data/app/views/effective/cpd_audits/_missing_info.html.haml +1 -1
- data/app/views/effective/cpd_audits/_summary.html.haml +2 -0
- data/app/views/effective/cpd_audits/_summary_fields.html.haml +1 -0
- data/app/views/effective/cpd_audits/submit.html.haml +2 -2
- data/lib/effective_cpd/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: 1b7b747aec6776c9ea09dc1e36517084133694dca965f7d32ec8a20d66a9596d
|
4
|
+
data.tar.gz: c21e47933d6026f612f79f0f63b52895d7319b2db744eb53b68e7881c280f497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec38bd12ba35145518b3285534b32e006a86fa6e29ed39da8fae6d6554ac554b0ffb676aaa32fc592920a3d4c2e8181c9138c9a5338edcfabd789d612af930be
|
7
|
+
data.tar.gz: 6859e61d222b1fdcea05e91188f0b783de4ed76dd4f10dc8ce50dc0773ae4b4f5f39c90d2bb5ff188928bf2401ad7cd1e40b3ec4f1a2a2a7efd8e05063d0adb6
|
@@ -43,6 +43,13 @@ module Admin
|
|
43
43
|
].compact.join(' ')
|
44
44
|
}
|
45
45
|
|
46
|
+
submit :complete, 'Ready to Review', success: -> {
|
47
|
+
[
|
48
|
+
"Successfully completed #{resource}",
|
49
|
+
("and sent reviewers an audit ready notification" unless resource.email_form_skip)
|
50
|
+
].compact.join(' ')
|
51
|
+
}
|
52
|
+
|
46
53
|
submit :missing, 'Missing Info', success: -> {
|
47
54
|
[
|
48
55
|
"Successfully marked #{resource} as missing info",
|
@@ -12,5 +12,23 @@ module EffectiveCpdAuditsHelper
|
|
12
12
|
[['Yes, I would like to request an extension', true], ['No extension request', false]]
|
13
13
|
end
|
14
14
|
|
15
|
+
def cpd_audit_new_reviewer_collection(cpd_audit = nil)
|
16
|
+
cpd_audit ||= EffectiveCpd.CpdAudit.new
|
17
|
+
raise('expected a cpd audit') unless cpd_audit.class.respond_to?(:effective_cpd_audit?)
|
18
|
+
|
19
|
+
cpd_audit.current_user = current_user
|
20
|
+
users = cpd_audit.suggested_cpd_audit_reviewers()
|
21
|
+
|
22
|
+
users.map do |user|
|
23
|
+
in_progress = content_tag(:span, class: 'badge badge-info') do
|
24
|
+
reviews = user.cpd_audit_reviews.count { |review| review.in_progress? }
|
25
|
+
"#{pluralize(reviews, 'review')} in progress"
|
26
|
+
end
|
27
|
+
|
28
|
+
html = content_tag(:div, "#{user} #{in_progress}")
|
29
|
+
|
30
|
+
[user.to_s, user.to_param, { 'data-html': html }]
|
31
|
+
end
|
32
|
+
end
|
15
33
|
|
16
34
|
end
|
@@ -352,11 +352,11 @@ module EffectiveCpdAudit
|
|
352
352
|
when 'submitted'
|
353
353
|
summary = "Auditee has submitted their audit wizard."
|
354
354
|
tasks = "The following tasks remain before it can be completed:"
|
355
|
-
approval = "Waiting on
|
355
|
+
approval = "Waiting on completeness check, review and determination."
|
356
356
|
items = completed_requirements.map { |item, done| "<li>#{item}: #{done ? 'Complete' : 'Incomplete'}</li>" }.join
|
357
357
|
completed_requirements.present? ? "<p>#{summary} #{tasks}</p><ul>#{items}</ul>" : "#{summary} #{approval}"
|
358
358
|
when 'completed'
|
359
|
-
"All required materials have been provided. This audit will transition to 'reviewed' after all reviewers have finished."
|
359
|
+
"All required materials have been provided. Ready to review. This audit will transition to 'reviewed' after all reviewers have finished."
|
360
360
|
when 'missing_info'
|
361
361
|
"Missing the following information: <ul><li>#{missing_info_reason}</li></ul>"
|
362
362
|
when 'reviewed'
|
@@ -508,11 +508,13 @@ module EffectiveCpdAudit
|
|
508
508
|
def complete!
|
509
509
|
raise('audit must have been submitted to complete!') unless was_submitted?
|
510
510
|
|
511
|
+
existing = cpd_audit_reviews.select { |cpd_audit_review| cpd_audit_review.persisted? }
|
512
|
+
|
511
513
|
assign_attributes(missing_info_reason: nil)
|
512
514
|
completed!
|
513
515
|
|
514
516
|
# Each of these sends a cpd_audit_review_ready email
|
515
|
-
|
517
|
+
existing.each { |cpd_audit_review| cpd_audit_review.ready! }
|
516
518
|
|
517
519
|
true
|
518
520
|
end
|
@@ -616,4 +618,8 @@ module EffectiveCpdAudit
|
|
616
618
|
assign_attributes(anonymous_number: number, anonymous_name: name)
|
617
619
|
end
|
618
620
|
|
621
|
+
def suggested_cpd_audit_reviewers
|
622
|
+
(current_user || user).class.send(EffectiveCpd.audit_reviewer_user_scope).sorted_by_in_progress_cpd_audit_reviews
|
623
|
+
end
|
624
|
+
|
619
625
|
end
|
@@ -125,7 +125,10 @@ module EffectiveCpdAuditReview
|
|
125
125
|
validates :anonymous_number, presence: true
|
126
126
|
end
|
127
127
|
|
128
|
-
after_commit(on: :create) {
|
128
|
+
after_commit(on: :create) {
|
129
|
+
send_email(cpd_audit.was_completed? ? :cpd_audit_review_ready : :cpd_audit_review_opened)
|
130
|
+
}
|
131
|
+
|
129
132
|
after_commit(on: :destroy) { cpd_audit.try_review! }
|
130
133
|
|
131
134
|
def dynamic_wizard_statement_steps
|
@@ -26,6 +26,16 @@ module EffectiveCpdUser
|
|
26
26
|
|
27
27
|
scope :cpd_audit_auditees, -> { without_role(:cpd_audit_reviewer).without_role(:admin) }
|
28
28
|
scope :cpd_audit_reviewers, -> { with_role(:cpd_audit_reviewer) }
|
29
|
+
|
30
|
+
scope :sorted_by_in_progress_cpd_audit_reviews, -> {
|
31
|
+
left_joins(:cpd_audit_reviews)
|
32
|
+
.where(cpd_audit_reviews: { submitted_at: nil})
|
33
|
+
.includes(:cpd_audit_reviews)
|
34
|
+
.group(:id)
|
35
|
+
.order('COUNT(cpd_audit_reviews.id) ASC')
|
36
|
+
.order('MAX(cpd_audit_reviews.created_at) ASC')
|
37
|
+
.order('id ASC')
|
38
|
+
}
|
29
39
|
end
|
30
40
|
|
31
41
|
# This one will actually be enforced or displayed first
|
@@ -11,6 +11,9 @@
|
|
11
11
|
= render('admin/cpd_audits/audit_reviewer_fields', f: f)
|
12
12
|
|
13
13
|
%p Send email
|
14
|
-
|
14
|
+
- if cpd_audit_review.cpd_audit&.was_completed?
|
15
|
+
= email_form_fields(f, :cpd_audit_review_ready)
|
16
|
+
- else
|
17
|
+
= email_form_fields(f, :cpd_audit_review_opened)
|
15
18
|
|
16
19
|
= effective_submit(f)
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
= f.select :
|
1
|
+
= f.hidden_field :user_type, value: current_user.class.name
|
2
|
+
= f.select :user_id, cpd_audit_new_reviewer_collection(f.object.cpd_audit), label: 'Audit Reviewer'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= card('Determination') do
|
2
2
|
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
3
|
-
%p This action will close this audit with the following determination:
|
3
|
+
%p This action will <strong>close</strong> this audit with the following determination:
|
4
4
|
|
5
5
|
= f.select :determination, cpd_audit.cpd_audit_level.determinations
|
6
6
|
|
@@ -1,17 +1,33 @@
|
|
1
1
|
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
2
2
|
= f.hidden_field :id
|
3
3
|
|
4
|
-
%p
|
4
|
+
%p This audit will be marked as <strong>completed information</strong> and <strong>ready for review</strong>.
|
5
5
|
|
6
|
-
|
6
|
+
- reviewers = cpd_audit.cpd_audit_reviews
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
- if reviewers.present?
|
9
|
+
%h3 Email to send
|
10
|
+
%p
|
11
|
+
- email = Effective::EmailTemplate.where(template_name: :cpd_audit_review_ready).first!
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
The existing
|
14
|
+
= link_to(pluralize(reviewers.length, 'assigned reviewer'), '#audit-reviews', 'data-click-tab': true)
|
15
|
+
will be sent an
|
16
|
+
= link_to('cpd_audit_review_ready email', effective_email_templates.edit_admin_email_template_path(email))
|
17
|
+
email.
|
14
18
|
|
15
|
-
|
19
|
+
- if reviewers.blank?
|
20
|
+
%p Please assign one or more reviewers:
|
16
21
|
|
17
|
-
|
22
|
+
- # Pre-select the first reviewer if present
|
23
|
+
- if f.object.cpd_audit_reviews.blank?
|
24
|
+
- f.object.cpd_audit_reviews.build(user: cpd_audit.suggested_cpd_audit_reviewers.first)
|
25
|
+
|
26
|
+
= f.has_many :cpd_audit_reviews, class: 'tight' do |fr|
|
27
|
+
= card('Reviewer') do
|
28
|
+
= render('admin/cpd_audits/audit_reviewer_fields', form: fr, f: fr)
|
29
|
+
|
30
|
+
%p Send email
|
31
|
+
= email_form_fields(fr, :cpd_audit_review_ready)
|
32
|
+
|
33
|
+
= f.submit 'Ready to Review', border: false, center: true, 'data-confirm': "Complete #{f.object}?"
|
@@ -2,9 +2,9 @@
|
|
2
2
|
%p The audittee has the following deadlines:
|
3
3
|
|
4
4
|
%ul
|
5
|
-
%li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest}
|
6
|
-
%li To request exemption: #{f.object.deadline_to_exemption}
|
7
|
-
%li To request extension: #{f.object.deadline_to_extension}
|
5
|
+
%li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest.presence || 'None'}
|
6
|
+
%li To request exemption: #{f.object.deadline_to_exemption.presence || 'None'}
|
7
|
+
%li To request extension: #{f.object.deadline_to_extension.presence || 'None'}
|
8
8
|
|
9
9
|
= f.check_box :ignore_deadlines, label: 'Yes, ignore audittee deadlines and allow these actions to be performed'
|
10
10
|
|
@@ -8,6 +8,8 @@
|
|
8
8
|
= f.date_field :notification_date, label: 'Date of notification', required: false,
|
9
9
|
hint: "the starting date for any deadline calculations. leave blank for today's date"
|
10
10
|
|
11
|
+
= render('admin/cpd_audits/form_new_fields', form: f, f: f)
|
12
|
+
|
11
13
|
%h2 Auditee
|
12
14
|
= card('Auditee') do
|
13
15
|
%p.text-muted The auditee is the person being audited
|
@@ -0,0 +1 @@
|
|
1
|
+
-# Intentionally blank
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
= accordion do
|
8
8
|
- if EffectiveResources.authorized?(self, :complete, cpd_audit)
|
9
|
-
= collapse '
|
9
|
+
= collapse 'Ready for Review' do
|
10
10
|
= render('admin/cpd_audits/form_complete', cpd_audit: cpd_audit)
|
11
11
|
|
12
12
|
- if EffectiveResources.authorized?(self, :missing, cpd_audit)
|
@@ -14,5 +14,5 @@
|
|
14
14
|
= render('admin/cpd_audits/form_missing_info', cpd_audit: cpd_audit)
|
15
15
|
|
16
16
|
- if EffectiveResources.authorized?(self, :close, cpd_audit)
|
17
|
-
= collapse 'Close
|
17
|
+
= collapse 'Close with Determination' do
|
18
18
|
= render('admin/cpd_audits/form_close', cpd_audit: cpd_audit)
|
@@ -98,7 +98,7 @@
|
|
98
98
|
- # Waiting to Complete
|
99
99
|
- unless cpd_audit.was_completed?
|
100
100
|
%tr
|
101
|
-
%td
|
101
|
+
%td Ready Check
|
102
102
|
%td= cpd_audit.submitted_at&.strftime('%F') || '-'
|
103
103
|
%td
|
104
104
|
- cpd_audit.completed_requirements.each do |requirement, completed|
|
@@ -108,7 +108,7 @@
|
|
108
108
|
|
109
109
|
%td
|
110
110
|
- if cpd_audit.submitted?
|
111
|
-
= link_to '
|
111
|
+
= link_to 'Process: Ready or Missing Info', '#process', 'data-click-tab': true, class: 'btn btn-sm btn-primary'
|
112
112
|
|
113
113
|
- # Missing Information
|
114
114
|
%tr
|
@@ -120,10 +120,15 @@
|
|
120
120
|
- if cpd_audit.was_missing_info? && cpd_audit.missing_info_reason.blank?
|
121
121
|
= icon('check', class: 'small-1')
|
122
122
|
Done
|
123
|
+
|
124
|
+
- if cpd_audit.was_completed? && !cpd_audit.was_missing_info?
|
125
|
+
= icon('check', class: 'small-1')
|
126
|
+
No Missing Info
|
127
|
+
|
123
128
|
%td
|
124
129
|
|
125
130
|
%tr
|
126
|
-
%td
|
131
|
+
%td Ready for Review
|
127
132
|
%td= cpd_audit.completed_at&.strftime('%F') || '-'
|
128
133
|
%td
|
129
134
|
- if cpd_audit.was_completed?
|
@@ -70,5 +70,9 @@
|
|
70
70
|
%td= cpd_audit_review.recommendation.presence || '-'
|
71
71
|
|
72
72
|
%tr
|
73
|
-
%th Reviewer
|
74
|
-
%td
|
73
|
+
%th Reviewer Notes
|
74
|
+
%td
|
75
|
+
- if cpd_audit_review.comments.present?
|
76
|
+
= simple_format(cpd_audit_review.comments)
|
77
|
+
- else
|
78
|
+
None
|
@@ -20,6 +20,6 @@
|
|
20
20
|
= f.text_area :conflict_of_interest_reason, required: true
|
21
21
|
|
22
22
|
%hr
|
23
|
-
= f.text_area :comments, label: 'Reviewer
|
23
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
24
24
|
|
25
25
|
= f.submit 'Save and Continue', center: true
|
@@ -30,6 +30,6 @@
|
|
30
30
|
= render('/effective/cpd_audit_review_items/fields', f: fi, cpd_audit_review: resource)
|
31
31
|
|
32
32
|
%hr
|
33
|
-
= f.text_area :comments, label: 'Reviewer
|
33
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
34
34
|
|
35
35
|
= f.submit 'Save and Continue', center: true
|
@@ -3,7 +3,7 @@
|
|
3
3
|
= collapse('Show audit...', card_class: '') do
|
4
4
|
.mt-4= render('effective/cpd_audits/cpd_audit', cpd_audit: resource.cpd_audit)
|
5
5
|
|
6
|
-
%p Please provide any feedback for #{resource.cpd_audit.name}:
|
6
|
+
%p Please provide any final feedback for #{resource.cpd_audit.name}:
|
7
7
|
|
8
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
9
9
|
= f.hidden_field :current_step
|
@@ -11,6 +11,6 @@
|
|
11
11
|
= f.text_area :feedback, label: 'Feedback for the auditee'
|
12
12
|
|
13
13
|
%hr
|
14
|
-
= f.text_area :comments, label: 'Reviewer
|
14
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
15
15
|
|
16
16
|
= f.submit 'Save and Continue', center: true
|
@@ -12,6 +12,6 @@
|
|
12
12
|
%li= link_to(file.filename, url_for(file), target: '_blank')
|
13
13
|
|
14
14
|
%hr
|
15
|
-
= f.text_area :comments, label: 'Reviewer
|
15
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
16
16
|
|
17
17
|
= f.submit 'Save and Continue', center: true
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
%hr
|
6
6
|
|
7
|
-
%p The following rolling
|
8
|
-
= f.text_area :comments, label: 'Reviewer
|
7
|
+
%p The following rolling notes will be displayed for your use on each step.
|
8
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
9
9
|
|
10
10
|
= f.submit 'Save and Continue', center: true
|
@@ -18,6 +18,6 @@
|
|
18
18
|
= f.radios :recommendation, recommendations, inline: true
|
19
19
|
|
20
20
|
%hr
|
21
|
-
= f.text_area :comments, label: 'Reviewer
|
21
|
+
= f.text_area :comments, label: 'Reviewer notes', hint: 'Not displayed to the auditee'
|
22
22
|
|
23
23
|
= f.submit 'Save and Continue', center: true
|
@@ -11,4 +11,4 @@
|
|
11
11
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
12
12
|
= f.hidden_field :current_step
|
13
13
|
|
14
|
-
= f.submit 'Submit Audit Review', center: true
|
14
|
+
= f.submit 'Submit Audit Review', center: true, 'data-confirm': "Really Submit Audit Review?"
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
%p
|
7
7
|
Please revisit each wizard step and
|
8
|
-
= link_to 'Complete all missing information', wizard_path(:
|
8
|
+
= link_to 'Complete all missing information', wizard_path(:instructions), class: 'btn btn-primary'
|
9
9
|
for this audit.
|
10
10
|
|
11
11
|
%p
|
@@ -0,0 +1 @@
|
|
1
|
+
- # Intentionally blank
|
@@ -13,6 +13,6 @@
|
|
13
13
|
= f.hidden_field :current_step
|
14
14
|
|
15
15
|
- if EffectiveResources.authorized?(self, :resubmit, resource)
|
16
|
-
= f.submit 'Resubmit Audit', center: true
|
16
|
+
= f.submit 'Resubmit Audit', center: true, 'data-confirm': "Really Resubmit Audit?"
|
17
17
|
- else
|
18
|
-
= f.submit 'Submit Audit', center: true
|
18
|
+
= f.submit 'Submit Audit', center: true, 'data-confirm': "Really Submit Audit?"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_cpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
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-
|
11
|
+
date: 2023-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -311,6 +311,7 @@ files:
|
|
311
311
|
- app/views/admin/cpd_audits/_form_files.html.haml
|
312
312
|
- app/views/admin/cpd_audits/_form_missing_info.html.haml
|
313
313
|
- app/views/admin/cpd_audits/_form_new.html.haml
|
314
|
+
- app/views/admin/cpd_audits/_form_new_fields.html.haml
|
314
315
|
- app/views/admin/cpd_audits/_form_process.html.haml
|
315
316
|
- app/views/admin/cpd_audits/_status.html.haml
|
316
317
|
- app/views/admin/cpd_bulk_audits/_form.html.haml
|
@@ -393,6 +394,7 @@ files:
|
|
393
394
|
- app/views/effective/cpd_audits/_layout.html.haml
|
394
395
|
- app/views/effective/cpd_audits/_missing_info.html.haml
|
395
396
|
- app/views/effective/cpd_audits/_summary.html.haml
|
397
|
+
- app/views/effective/cpd_audits/_summary_fields.html.haml
|
396
398
|
- app/views/effective/cpd_audits/_waiting.html.haml
|
397
399
|
- app/views/effective/cpd_audits/chat.html.haml
|
398
400
|
- app/views/effective/cpd_audits/conflict.html.haml
|