effective_cpd 0.2.0 → 0.2.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/cpd_audits_controller.rb +2 -0
- data/app/models/concerns/effective_cpd_user.rb +4 -0
- data/app/models/effective/cpd_audit.rb +35 -20
- data/app/models/effective/cpd_audit_review.rb +1 -1
- data/app/views/effective/cpd_audits/_cpd.html.haml +13 -0
- data/app/views/effective/cpd_audits/conflict.html.haml +2 -1
- data/app/views/effective/cpd_audits/cpd.html.haml +19 -0
- data/app/views/effective/cpd_audits/exemption.html.haml +2 -1
- data/app/views/effective/cpd_audits/extension.html.haml +2 -1
- data/config/routes.rb +1 -1
- 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: 814bc46856da481c1463852a7bcf2070e48fb494fd107f28e11385b8e4c6a4a5
|
4
|
+
data.tar.gz: e304434f2182696dcd63a7ccefb8f06191230ec023988950c3efca2f74ccf23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d691015664b852d423d7dffe069b3ce96a3ad966918034cb1313325bcc0665a4a05b3bef44d205beccf0223cbc25429f0b806109f65579d62b13feddeed7c165
|
7
|
+
data.tar.gz: 732028a6c199f87be5e9cb3934ae9ba87b1d8a56b142ea2adddbec68f29b914535d79fe2a84e5603f402976dc4877dd46b0b5eecb5f56ccefc9cf735388907ba
|
@@ -32,6 +32,8 @@ module Effective
|
|
32
32
|
when :extension
|
33
33
|
params.require(:effective_cpd_audit)
|
34
34
|
.permit(:current_step, :extension_request, :extension_request_date, :extension_request_reason)
|
35
|
+
when :cpd
|
36
|
+
params.require(:effective_cpd_audit).permit(:current_step)
|
35
37
|
when :questionnaire
|
36
38
|
params.require(:effective_cpd_audit).permit(:current_step)
|
37
39
|
when :files
|
@@ -56,6 +56,7 @@ module Effective
|
|
56
56
|
exemption: 'Request Exemption',
|
57
57
|
extension: 'Request Extension',
|
58
58
|
waiting: 'Waiting',
|
59
|
+
cpd: 'CPD',
|
59
60
|
|
60
61
|
questionnaire: 'Questionnaire',
|
61
62
|
# ... There will be one step per cpd_audit_level_sections here
|
@@ -129,6 +130,21 @@ module Effective
|
|
129
130
|
validates :extension_request_date, presence: true, if: -> { extension_request? }
|
130
131
|
validates :extension_request_reason, presence: true, if: -> { extension_request? }
|
131
132
|
|
133
|
+
validate(if: -> { current_step == :conflict && conflict_of_interest? }) do
|
134
|
+
deadline = deadline_to_conflict_of_interest()
|
135
|
+
self.errors.add(:base, 'deadline to declare conflict of interest has already passed') if deadline && deadline < Time.zone.now
|
136
|
+
end
|
137
|
+
|
138
|
+
validate(if: -> { current_step == :exemption && exemption_request? }) do
|
139
|
+
deadline = deadline_to_exemption()
|
140
|
+
self.errors.add(:base, 'deadline to request exemption has already passed') if deadline && deadline < Time.zone.now
|
141
|
+
end
|
142
|
+
|
143
|
+
validate(if: -> { current_step == :extension && extension_request? }) do
|
144
|
+
deadline = deadline_to_extension()
|
145
|
+
self.errors.add(:base, 'deadline to request extension has already passed') if deadline && deadline < Time.zone.now
|
146
|
+
end
|
147
|
+
|
132
148
|
validate(if: -> { determination.present? }) do
|
133
149
|
unless cpd_audit_level.determinations.include?(determination)
|
134
150
|
self.errors.add(:determination, 'must exist in this audit level')
|
@@ -146,25 +162,6 @@ module Effective
|
|
146
162
|
persisted? ? "#{cpd_audit_level} Audit of #{user}" : 'audit'
|
147
163
|
end
|
148
164
|
|
149
|
-
acts_as_wizard(
|
150
|
-
start: 'Start',
|
151
|
-
information: 'Information',
|
152
|
-
instructions: 'Instructions',
|
153
|
-
|
154
|
-
# These 4 steps are determined by audit_level settings
|
155
|
-
conflict: 'Conflict of Interest',
|
156
|
-
exemption: 'Request Exemption',
|
157
|
-
extension: 'Request Extension',
|
158
|
-
waiting: 'Waiting on Request',
|
159
|
-
|
160
|
-
questionaire: 'Questionaire',
|
161
|
-
# ... There will be one step per cpd_audit_level_sections here
|
162
|
-
files: 'Upload Resume',
|
163
|
-
|
164
|
-
submit: 'Confirm & Submit',
|
165
|
-
complete: 'Complete'
|
166
|
-
)
|
167
|
-
|
168
165
|
def dynamic_wizard_steps
|
169
166
|
cpd_audit_level.cpd_audit_level_sections.each_with_object({}) do |section, h|
|
170
167
|
h["section#{section.position+1}".to_sym] = section.title
|
@@ -195,7 +192,7 @@ module Effective
|
|
195
192
|
steps += [:waiting]
|
196
193
|
end
|
197
194
|
|
198
|
-
steps += [:questionnaire] + dynamic_wizard_steps.keys + [:files, :submit, :complete]
|
195
|
+
steps += [:cpd, :questionnaire] + dynamic_wizard_steps.keys + [:files, :submit, :complete]
|
199
196
|
|
200
197
|
steps
|
201
198
|
end
|
@@ -314,6 +311,24 @@ module Effective
|
|
314
311
|
send_email(:cpd_audit_extension_denied)
|
315
312
|
end
|
316
313
|
|
314
|
+
# Require CPD step
|
315
|
+
def user_cpd_required?
|
316
|
+
return false unless user.cpd_audit_cpd_required?
|
317
|
+
required_cpd_cycle.present?
|
318
|
+
end
|
319
|
+
|
320
|
+
def user_cpd_completed?
|
321
|
+
return true if required_cpd_cycle.blank?
|
322
|
+
user.cpd_statements.any? { |s| s.completed? && s.cpd_cycle_id == required_cpd_cycle.id }
|
323
|
+
end
|
324
|
+
|
325
|
+
def required_cpd_cycle
|
326
|
+
@required_cpd_cycle ||= begin
|
327
|
+
last_year = ((notification_date || created_at || Time.zone.now) - 1.year).all_year
|
328
|
+
Effective::CpdCycle.available.where(start_at: last_year).first
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
317
332
|
# Auditee wizard action
|
318
333
|
def submit!
|
319
334
|
submitted!
|
@@ -7,7 +7,7 @@ module Effective
|
|
7
7
|
belongs_to :cpd_audit_level
|
8
8
|
belongs_to :user, polymorphic: true # Auditor
|
9
9
|
|
10
|
-
has_many :cpd_audit_review_items, -> { CpdAuditReviewItem.sorted }, inverse_of: :cpd_audit_review
|
10
|
+
has_many :cpd_audit_review_items, -> { CpdAuditReviewItem.sorted }, inverse_of: :cpd_audit_review, dependent: :destroy
|
11
11
|
accepts_nested_attributes_for :cpd_audit_review_items, reject_if: :all_blank, allow_destroy: true
|
12
12
|
|
13
13
|
if respond_to?(:log_changes)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
= card(cpd_audit.wizard_step_title(step)) do
|
2
|
+
- cpd_cycle = cpd_audit.required_cpd_cycle
|
3
|
+
|
4
|
+
%table.table
|
5
|
+
%tbody
|
6
|
+
%tr
|
7
|
+
%th CPD Requirements
|
8
|
+
%td
|
9
|
+
- if cpd_audit.user_cpd_required? == false
|
10
|
+
Not required
|
11
|
+
|
12
|
+
- if cpd_cycle.present?
|
13
|
+
= cpd_cycle
|
@@ -5,7 +5,8 @@
|
|
5
5
|
- resource.cpd_audit_reviews.each do |cpd_audit_review|
|
6
6
|
%li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
|
7
7
|
|
8
|
-
|
8
|
+
- if resource.deadline_to_conflict_of_interest.present?
|
9
|
+
%p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
|
9
10
|
|
10
11
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
11
12
|
= f.hidden_field :current_step
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= render('layout') do
|
2
|
+
- cpd_cycle = resource.required_cpd_cycle
|
3
|
+
|
4
|
+
- if resource.user_cpd_required? == false
|
5
|
+
%p You are not required to submit a CPD statement at this time.
|
6
|
+
- elsif resource.user_cpd_completed?
|
7
|
+
%p Thank you! You have submitted a CPD statement for the required #{cpd_cycle} year.
|
8
|
+
- elsif cpd_cycle.present?
|
9
|
+
%p You must submit a CPD statement for the #{cpd_cycle} year before you may continue.
|
10
|
+
|
11
|
+
- if cpd_cycle.present?
|
12
|
+
%p= link_to("#{cpd_cycle} Statement", effective_cpd.cpd_cycle_cpd_statement_build_path(cpd_cycle, :new, :start), class: 'btn btn-primary', target: '_blank')
|
13
|
+
|
14
|
+
- if (resource.user_cpd_required? == false || resource.user_cpd_completed?)
|
15
|
+
|
16
|
+
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
17
|
+
= f.hidden_field :current_step
|
18
|
+
|
19
|
+
= f.submit 'Save and Continue', center: true
|
@@ -2,7 +2,8 @@
|
|
2
2
|
- if resource.was_exemption_requested?
|
3
3
|
= render('effective/cpd_audits/exemption', cpd_audit: resource, step: :exemption)
|
4
4
|
|
5
|
-
|
5
|
+
- if resource.deadline_to_exemption.present?
|
6
|
+
%p The deadline to request an exemption is: #{resource.deadline_to_exemption.strftime('%F')}.
|
6
7
|
|
7
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
8
9
|
= f.hidden_field :current_step
|
@@ -2,7 +2,8 @@
|
|
2
2
|
- if resource.was_extension_requested?
|
3
3
|
= render('effective/cpd_audits/extension', cpd_audit: resource, step: :extension)
|
4
4
|
|
5
|
-
|
5
|
+
- if resource.deadline_to_extension.present?
|
6
|
+
%p The deadline to request an extension is: #{resource.deadline_to_extension.strftime('%F')}.
|
6
7
|
|
7
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
8
9
|
= f.hidden_field :current_step
|
data/config/routes.rb
CHANGED
@@ -41,7 +41,7 @@ EffectiveCpd::Engine.routes.draw do
|
|
41
41
|
resources :cpd_audit_levels, except: [:show]
|
42
42
|
resources :cpd_audit_level_questions, except: [:show]
|
43
43
|
|
44
|
-
resources :cpd_audits, except: [:show
|
44
|
+
resources :cpd_audits, except: [:show]
|
45
45
|
resources :cpd_audit_reviews
|
46
46
|
end
|
47
47
|
|
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: 0.2.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2022-02-08 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/effective/cpd_audit_reviews/submit.html.haml
|
312
312
|
- app/views/effective/cpd_audit_reviews/waiting.html.haml
|
313
313
|
- app/views/effective/cpd_audits/_conflict.html.haml
|
314
|
+
- app/views/effective/cpd_audits/_cpd.html.haml
|
314
315
|
- app/views/effective/cpd_audits/_cpd_audit.html.haml
|
315
316
|
- app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml
|
316
317
|
- app/views/effective/cpd_audits/_exemption.html.haml
|
@@ -321,6 +322,7 @@ files:
|
|
321
322
|
- app/views/effective/cpd_audits/_waiting.html.haml
|
322
323
|
- app/views/effective/cpd_audits/complete.html.haml
|
323
324
|
- app/views/effective/cpd_audits/conflict.html.haml
|
325
|
+
- app/views/effective/cpd_audits/cpd.html.haml
|
324
326
|
- app/views/effective/cpd_audits/cpd_audit_level_section.html.haml
|
325
327
|
- app/views/effective/cpd_audits/exemption.html.haml
|
326
328
|
- app/views/effective/cpd_audits/extension.html.haml
|