effective_cpd 1.4.8 → 1.5.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/assets/stylesheets/effective_cpd/_activities.scss +6 -0
- data/app/models/concerns/effective_cpd_audit.rb +1 -0
- data/app/models/concerns/effective_cpd_user.rb +28 -10
- data/app/models/effective/cpd_target.rb +1 -1
- data/app/views/admin/cpd_audits/_form_close.html.haml +6 -7
- data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +3 -3
- data/app/views/admin/users/_form_cpd_targets.html.haml +17 -6
- data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +1 -1
- data/app/views/effective/cpd_audit_reviews/_summary.html.haml +2 -4
- data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +1 -1
- data/app/views/effective/cpd_audits/_summary.html.haml +2 -4
- data/app/views/effective/cpd_statements/complete.html.haml +1 -1
- data/config/locales/effective_cpd.en.yml +7 -7
- data/db/migrate/01_create_effective_cpd.rb.erb +20 -17
- data/lib/effective_cpd/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: '007309633bd01dfa4ad2731f7c36f6d576c471c6de1f8ec21f355da5615a2b0d'
|
4
|
+
data.tar.gz: f1a0b42227c58dea846ad8e288bccec8472ce05a747b790ef4a6b83ee8ab0539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d7615012e34a640bd5e3009559a431638880894f819910cbc3d6df770316c6e4329bebb2dfdd28cf44d7c39abf2f63f1682205232f5a8bea5f43c9e7b25c73
|
7
|
+
data.tar.gz: 99e4617ac625fa40c15e60cbe535824be383edf62306ebd3337b01204c5a03d9f3b89c7c441045848f932fcdb1c21c564aa349c3334eddb2c2eee9c73a54631e
|
@@ -26,7 +26,7 @@ module EffectiveCpdUser
|
|
26
26
|
|
27
27
|
# Effective scoped
|
28
28
|
has_many :cpd_targets, -> { order(:cpd_cycle_id) }, inverse_of: :user, class_name: 'Effective::CpdTarget', dependent: :delete_all
|
29
|
-
accepts_nested_attributes_for :cpd_targets, reject_if:
|
29
|
+
accepts_nested_attributes_for :cpd_targets, reject_if: :reject_cpd_target_attributes, allow_destroy: true
|
30
30
|
|
31
31
|
# These two should not be sorted
|
32
32
|
scope :cpd_audit_auditees, -> { without_role(:cpd_audit_reviewer).without_role(:admin) }
|
@@ -43,7 +43,7 @@ module EffectiveCpdUser
|
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
46
|
-
#
|
46
|
+
# The required or targeted number of credits for this user in this cycle
|
47
47
|
def cpd_target_score(cpd_cycle:)
|
48
48
|
target = cpd_target(cpd_cycle: cpd_cycle)
|
49
49
|
return target.score if target&.score.present?
|
@@ -51,8 +51,15 @@ module EffectiveCpdUser
|
|
51
51
|
default_cpd_target_score(cpd_cycle: cpd_cycle)
|
52
52
|
end
|
53
53
|
|
54
|
-
#
|
55
|
-
|
54
|
+
# Whether the user can submit a statement without the required number of credits
|
55
|
+
def cpd_target_score_required_to_submit?(cpd_cycle:)
|
56
|
+
target = cpd_target(cpd_cycle: cpd_cycle)
|
57
|
+
return target.required_to_submit? unless target&.required_to_submit.nil?
|
58
|
+
|
59
|
+
default_cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Required for this user category without the targets. Used to display defaults on admin form.
|
56
63
|
def default_cpd_target_score(cpd_cycle:)
|
57
64
|
if self.class.try(:effective_memberships_user?)
|
58
65
|
category = membership_categories_on(cpd_cycle.start_at)&.first if cpd_cycle.start_at.present?
|
@@ -63,10 +70,8 @@ module EffectiveCpdUser
|
|
63
70
|
end
|
64
71
|
end
|
65
72
|
|
66
|
-
|
67
|
-
|
68
|
-
return target.required_to_submit? unless target&.required_to_submit.nil?
|
69
|
-
|
73
|
+
# Required for this user category without the targets. Used to display defaults on admin form.
|
74
|
+
def default_cpd_target_score_required_to_submit?(cpd_cycle:)
|
70
75
|
cpd_cycle.required_to_submit?
|
71
76
|
end
|
72
77
|
|
@@ -103,10 +108,23 @@ module EffectiveCpdUser
|
|
103
108
|
|
104
109
|
# For the form
|
105
110
|
def build_cpd_targets
|
106
|
-
Effective::CpdCycle.sorted.all.
|
111
|
+
Effective::CpdCycle.sorted.all.map do |cpd_cycle|
|
107
112
|
cpd_target(cpd_cycle: cpd_cycle) || cpd_targets.new(cpd_cycle: cpd_cycle)
|
113
|
+
end.sort_by(&:cpd_cycle_id).reverse
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
def reject_cpd_target_attributes(atts)
|
119
|
+
# Reject if new record and blank
|
120
|
+
return true if (atts['id'].blank? && atts['score'].blank? && atts['required_to_submit'].blank?)
|
121
|
+
|
122
|
+
# Delete when ID present and score and required to submit blank
|
123
|
+
if (atts['id'].present? && atts['score'].blank? && atts['required_to_submit'].blank?)
|
124
|
+
atts.merge!({:_destroy => 1})
|
108
125
|
end
|
109
|
-
|
126
|
+
|
127
|
+
false
|
110
128
|
end
|
111
129
|
|
112
130
|
end
|
@@ -20,7 +20,7 @@ module Effective
|
|
20
20
|
scope :deep, -> { includes(:user, :cpd_cycle) }
|
21
21
|
scope :sorted, -> { order(:cpd_cycle_id) }
|
22
22
|
|
23
|
-
validates :score, numericality: { greater_than_or_equal_to: 0 }
|
23
|
+
validates :score, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
24
24
|
validates :required_to_submit, inclusion: { in: [true, false], message: "can't be blank" }
|
25
25
|
|
26
26
|
validates :cpd_cycle_id, uniqueness: { scope: [:user_id, :user_type], message: 'target already exists' }
|
@@ -1,10 +1,9 @@
|
|
1
|
-
=
|
2
|
-
|
3
|
-
%p This action will <strong>close</strong> this #{cpd_audit_label} with the following determination:
|
1
|
+
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
2
|
+
%p This action will <strong>close</strong> this #{cpd_audit_label} with the following determination:
|
4
3
|
|
5
|
-
|
4
|
+
= f.select :determination, cpd_audit.cpd_audit_level.determinations
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
%h2 Email to Send
|
7
|
+
= email_form_fields(f, :cpd_audit_closed)
|
9
8
|
|
10
|
-
|
9
|
+
= f.submit 'Close', center: true, 'data-confirm': "Really close #{cpd_audit}?"
|
@@ -43,7 +43,7 @@
|
|
43
43
|
= render 'admin/cpd_audits/form_files', cpd_audit: cpd_audit
|
44
44
|
|
45
45
|
- if cpd_audit.user_cpd_required?
|
46
|
-
= tab(cpd_audit.
|
46
|
+
= tab(cpd_audit.user.cpd_statements) do
|
47
47
|
- datatable = Admin::EffectiveCpdStatementsDatatable.new(user: cpd_audit.user)
|
48
48
|
= render_datatable(datatable, inline: true, simple: true)
|
49
49
|
|
@@ -55,6 +55,6 @@
|
|
55
55
|
= tab(cpd_audit.chats) do
|
56
56
|
= render 'admin/cpd_audits/form_chat', cpd_audit: cpd_audit
|
57
57
|
|
58
|
-
- if cpd_audit.respond_to?(:
|
58
|
+
- if cpd_audit.respond_to?(:logs_datatable)
|
59
59
|
= tab 'Logs' do
|
60
|
-
= render_inline_datatable(cpd_audit.
|
60
|
+
= render_inline_datatable(cpd_audit.logs_datatable)
|
@@ -1,12 +1,14 @@
|
|
1
1
|
= effective_form_with model: [:admin, user] do |f|
|
2
2
|
= f.hidden_field :id
|
3
3
|
|
4
|
-
%p
|
4
|
+
%p
|
5
|
+
#{cpd_targets_label} set the requirements checked when submitting a #{cpd_statement_label}
|
5
6
|
|
6
7
|
%table.table
|
7
8
|
%thead
|
8
9
|
%th= cpd_cycle_label
|
9
|
-
%th
|
10
|
+
%th Default Requirements
|
11
|
+
%th Requirements for #{f.object}
|
10
12
|
|
11
13
|
%tbody
|
12
14
|
= f.fields_for :cpd_targets, f.object.build_cpd_targets do |ctf|
|
@@ -17,18 +19,27 @@
|
|
17
19
|
|
18
20
|
- collection = Effective::CpdTarget::REQUIRED_TO_SUBMIT
|
19
21
|
- cpd_cycle = ctf.object.cpd_cycle
|
22
|
+
|
20
23
|
- target = f.object.cpd_target_score(cpd_cycle: cpd_cycle)
|
21
|
-
- target_placeholder = f.object.default_cpd_target_score(cpd_cycle: cpd_cycle) || '-'
|
22
24
|
- required_to_submit = f.object.cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle)
|
23
|
-
|
25
|
+
|
26
|
+
- default_target = f.object.default_cpd_target_score(cpd_cycle: cpd_cycle) || 0
|
27
|
+
- default_required_to_submit = f.object.default_cpd_target_score_required_to_submit?(cpd_cycle: cpd_cycle)
|
24
28
|
|
25
29
|
%tr
|
26
30
|
%td= link_to(cpd_cycle, effective_cpd.edit_admin_cpd_cycle_path(cpd_cycle), target: '_blank')
|
31
|
+
%td
|
32
|
+
%p
|
33
|
+
= pluralize(default_target, cpd_credit_label.downcase)
|
34
|
+
= default_required_to_submit ? 'required' : 'targeted'
|
35
|
+
and
|
36
|
+
= collection.find { |value| value.last == default_required_to_submit }.first.downcase
|
37
|
+
|
27
38
|
%td
|
28
39
|
.row
|
29
40
|
.col
|
30
|
-
= ctf.number_field :score,
|
41
|
+
= ctf.number_field :score, required: false, label: false
|
31
42
|
.col
|
32
|
-
= ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT,
|
43
|
+
= ctf.select :required_to_submit, Effective::CpdTarget::REQUIRED_TO_SUBMIT, required: false, label: false
|
33
44
|
|
34
45
|
= f.save "Save #{cpd_targets_label}", 'data-confirm': "Really Save #{cpd_targets_label} for #{user}?"
|
@@ -21,8 +21,7 @@
|
|
21
21
|
= link_to(cpd_audit_review.user, url)
|
22
22
|
%br
|
23
23
|
%small= mail_to cpd_audit_review.user.email
|
24
|
-
|
25
|
-
- if cpd_audit_review.anonymous? == false
|
24
|
+
- elsif cpd_audit_review.anonymous? == false
|
26
25
|
%p
|
27
26
|
= cpd_audit_review.user
|
28
27
|
%br
|
@@ -40,8 +39,7 @@
|
|
40
39
|
= link_to(cpd_audit.user, url)
|
41
40
|
%br
|
42
41
|
%small= mail_to cpd_audit.user.email
|
43
|
-
|
44
|
-
- if cpd_audit.anonymous? == false
|
42
|
+
- elsif cpd_audit.anonymous? == false
|
45
43
|
%p
|
46
44
|
= cpd_audit.user
|
47
45
|
%br
|
@@ -13,8 +13,7 @@
|
|
13
13
|
= link_to(cpd_audit.user, url)
|
14
14
|
%br
|
15
15
|
%small= mail_to cpd_audit.user.email
|
16
|
-
|
17
|
-
- if cpd_audit.anonymous? == false
|
16
|
+
- elsif cpd_audit.anonymous? == false
|
18
17
|
%p
|
19
18
|
= cpd_audit.user
|
20
19
|
%br
|
@@ -33,8 +32,7 @@
|
|
33
32
|
= link_to(cpd_audit_review.user, url)
|
34
33
|
%br
|
35
34
|
%small= mail_to cpd_audit_review.user.email
|
36
|
-
|
37
|
-
- if cpd_audit_review.anonymous? == false
|
35
|
+
- elsif cpd_audit_review.anonymous? == false
|
38
36
|
%p
|
39
37
|
= cpd_audit_review.user
|
40
38
|
%br
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
- raise('expected a submitted cpd_statement') unless resource.submitted_at.present?
|
5
5
|
|
6
|
-
.alert.alert-
|
6
|
+
.alert.alert-success.mb-4
|
7
7
|
Successfully submitted on #{resource.submitted_at.strftime('%F')}.
|
8
8
|
|
9
9
|
- if resource.cpd_cycle.all_steps_content.present?
|
@@ -9,11 +9,11 @@ en:
|
|
9
9
|
activerecord:
|
10
10
|
models:
|
11
11
|
# These ones might be app level
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
cpd_audit: 'CPD Audit'
|
13
|
+
cpd_audit_level: 'CPD Audit Level'
|
14
|
+
cpd_audit_review: 'CPD Audit Review'
|
15
|
+
cpd_bulk_audit: 'Bulk Create CPD Audit Review'
|
16
|
+
cpd_statement: 'CPD Statement'
|
17
17
|
|
18
18
|
# These ones should stay effective
|
19
19
|
effective/cpd_cycle: 'CPD Period'
|
@@ -23,10 +23,10 @@ en:
|
|
23
23
|
|
24
24
|
attributes:
|
25
25
|
# These ones might be app level
|
26
|
-
|
26
|
+
cpd_audit:
|
27
27
|
user: 'Auditee'
|
28
28
|
cpd_audit_comments: 'Reviewer Notes'
|
29
29
|
|
30
|
-
|
30
|
+
cpd_audit_review:
|
31
31
|
user: 'Reviewer'
|
32
32
|
comments: 'Reviewer Notes'
|
@@ -21,7 +21,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
21
21
|
end
|
22
22
|
|
23
23
|
create_table <%= @cpd_activities_table_name %> do |t|
|
24
|
-
t.
|
24
|
+
t.integer :cpd_category_id
|
25
25
|
|
26
26
|
t.string :title
|
27
27
|
t.integer :position
|
@@ -37,7 +37,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
37
37
|
end
|
38
38
|
|
39
39
|
create_table <%= @cpd_rules_table_name %> do |t|
|
40
|
-
t.
|
40
|
+
t.integer :cpd_cycle_id
|
41
|
+
|
41
42
|
t.integer :ruleable_id
|
42
43
|
t.string :ruleable_type
|
43
44
|
|
@@ -53,7 +54,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
53
54
|
end
|
54
55
|
|
55
56
|
create_table <%= @cpd_special_rules_table_name %> do |t|
|
56
|
-
t.
|
57
|
+
t.integer :cpd_cycle_id
|
57
58
|
|
58
59
|
t.decimal :max_credits_per_cycle
|
59
60
|
t.string :category
|
@@ -63,20 +64,22 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
63
64
|
end
|
64
65
|
|
65
66
|
create_table <%= @cpd_special_rule_mates_table_name %> do |t|
|
66
|
-
t.
|
67
|
-
t.
|
67
|
+
t.integer :cpd_rule_id
|
68
|
+
t.integer :cpd_special_rule_id
|
68
69
|
|
69
70
|
t.datetime :updated_at
|
70
71
|
t.datetime :created_at
|
71
72
|
end
|
72
73
|
|
73
74
|
create_table <%= @cpd_statement_activities_table_name %> do |t|
|
74
|
-
t.
|
75
|
-
t.
|
76
|
-
|
77
|
-
t.
|
75
|
+
t.integer :cpd_statement_id
|
76
|
+
t.string :cpd_statement_type
|
77
|
+
|
78
|
+
t.integer :cpd_activity_id
|
79
|
+
t.integer :cpd_category_id
|
80
|
+
t.integer :original_id
|
81
|
+
t.integer :cpd_cycle_id
|
78
82
|
|
79
|
-
t.references :cpd_cycle
|
80
83
|
t.integer :user_id
|
81
84
|
t.string :user_type
|
82
85
|
|
@@ -97,7 +100,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
97
100
|
end
|
98
101
|
|
99
102
|
create_table <%= @cpd_statements_table_name %> do |t|
|
100
|
-
t.
|
103
|
+
t.integer :cpd_cycle_id
|
101
104
|
|
102
105
|
t.integer :user_id
|
103
106
|
t.string :user_type
|
@@ -158,7 +161,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
158
161
|
t.integer :cpd_audit_level_id
|
159
162
|
t.string :cpd_audit_level_type
|
160
163
|
|
161
|
-
t.
|
164
|
+
t.integer :cpd_audit_level_section_id
|
162
165
|
|
163
166
|
t.text :title
|
164
167
|
t.string :category
|
@@ -171,7 +174,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
171
174
|
end
|
172
175
|
|
173
176
|
create_table <%= @cpd_audit_level_question_options_table_name %> do |t|
|
174
|
-
t.
|
177
|
+
t.integer :cpd_audit_level_question_id
|
175
178
|
|
176
179
|
t.text :title
|
177
180
|
t.integer :position
|
@@ -286,8 +289,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
286
289
|
t.integer :cpd_audit_id
|
287
290
|
t.string :cpd_audit_type
|
288
291
|
|
289
|
-
t.
|
290
|
-
t.
|
292
|
+
t.integer :cpd_audit_level_question_id
|
293
|
+
t.integer :cpd_audit_level_section_id
|
291
294
|
|
292
295
|
t.date :date
|
293
296
|
t.string :email
|
@@ -300,8 +303,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
|
|
300
303
|
end
|
301
304
|
|
302
305
|
create_table <%= @cpd_audit_response_options_table_name %> do |t|
|
303
|
-
t.
|
304
|
-
t.
|
306
|
+
t.integer :cpd_audit_response_id
|
307
|
+
t.integer :cpd_audit_level_question_option_id
|
305
308
|
|
306
309
|
t.datetime :updated_at
|
307
310
|
t.datetime :created_at
|
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.
|
4
|
+
version: 1.5.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: 2023-03-
|
11
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|