effective_cpd 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/cpd_statement_activities_controller.rb +2 -0
- data/app/controllers/admin/cpd_statements_controller.rb +11 -3
- data/app/controllers/effective/cpd_cycles_controller.rb +1 -1
- data/app/controllers/effective/cpd_statement_activities_controller.rb +1 -1
- data/app/controllers/effective/cpd_statements_controller.rb +7 -9
- data/app/datatables/admin/effective_cpd_statements_datatable.rb +1 -1
- data/app/datatables/effective_cpd_available_cycles_datatable.rb +2 -2
- data/app/datatables/effective_cpd_completed_statements_datatable.rb +2 -1
- data/app/models/concerns/effective_cpd_statement.rb +151 -0
- data/app/models/concerns/effective_cpd_user.rb +4 -1
- data/app/models/effective/cpd_scorer.rb +3 -3
- data/app/models/effective/cpd_statement.rb +1 -128
- data/app/models/effective/cpd_statement_activity.rb +3 -3
- data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +1 -1
- data/app/views/effective/cpd_statement_activities/_cpd_statement_activity.html.haml +4 -4
- data/app/views/effective/cpd_statement_activities/_form.html.haml +3 -3
- data/app/views/effective/cpd_statements/_activities_new.html.haml +3 -3
- data/app/views/effective/cpd_statements/complete.html.haml +9 -2
- data/app/views/effective/cpd_statements/submit.html.haml +1 -1
- data/config/effective_cpd.rb +5 -0
- data/lib/effective_cpd/engine.rb +1 -0
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/effective_cpd.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8723ba95966f6ebf0e5662db69fe207c34545f5e0501d782b28a0006877ea7a9
|
4
|
+
data.tar.gz: 8758d45e93512a1b4a6bf6eb896c085fe1328da78d87a7f89473dda83f1b76cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ae48a68cc1321798272b1d30d84c59cb89117280527b3ed87387ea02132a4245e7b278e1fa4e26990064136976c25143fa0ec9d614c95df791c260f8fbb51e
|
7
|
+
data.tar.gz: 657d3f4bb16a1afd2533960d64222263a63eb07bacf6d767e1e0ea83afc8759c12b42c08b8b78942d8174de02041ca9965d5ee5d0202d6198c897024959927a7
|
@@ -5,9 +5,17 @@ module Admin
|
|
5
5
|
|
6
6
|
include Effective::CrudController
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
resource_scope -> { EffectiveCpd.CpdStatement.deep.all }
|
9
|
+
datatable -> { Admin::EffectiveCpdStatementsDatatable.new }
|
10
|
+
|
11
|
+
page_title "#{EffectiveCpd.program_label} Statements", only: :index
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def permitted_params
|
16
|
+
model = (params.key?(:effective_cpd_statement) ? :effective_cpd_statement : :cpd_statement)
|
17
|
+
params.require(model).permit!
|
18
|
+
end
|
11
19
|
|
12
20
|
end
|
13
21
|
end
|
@@ -7,7 +7,7 @@ module Effective
|
|
7
7
|
cycle = Effective::CpdCycle.find(params[:id])
|
8
8
|
EffectiveResources.authorize!(self, :show, cycle)
|
9
9
|
|
10
|
-
statement =
|
10
|
+
statement = EffectiveCpd.CpdStatement.where(cpd_cycle: cycle, user: current_user).first
|
11
11
|
|
12
12
|
if statement.present?
|
13
13
|
redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(cycle, statement, statement.next_step)
|
@@ -4,7 +4,7 @@ module Effective
|
|
4
4
|
|
5
5
|
include Effective::CrudController
|
6
6
|
|
7
|
-
resource_scope -> { CpdStatement.find(params[:cpd_statement_id]).cpd_statement_activities }
|
7
|
+
resource_scope -> { EffectiveCpd.CpdStatement.find(params[:cpd_statement_id]).cpd_statement_activities }
|
8
8
|
|
9
9
|
# Score all statements when we change any activity
|
10
10
|
after_save do
|
@@ -7,7 +7,7 @@ module Effective
|
|
7
7
|
|
8
8
|
resource_scope do
|
9
9
|
cycle = Effective::CpdCycle.find(params[:cpd_cycle_id])
|
10
|
-
|
10
|
+
EffectiveCpd.CpdStatement.deep.where(cpd_cycle: cycle, user: current_user)
|
11
11
|
end
|
12
12
|
|
13
13
|
after_save(if: -> { step == :start }) do
|
@@ -16,8 +16,7 @@ module Effective
|
|
16
16
|
|
17
17
|
# Enforce one statement per user per cycle. Redirect them to an existing statement for this cycle.
|
18
18
|
before_action(only: [:new, :show]) do
|
19
|
-
|
20
|
-
existing = Effective::CpdStatement.where(cpd_cycle: cycle, user: current_user).where.not(id: resource).first
|
19
|
+
existing = resource_scope.where.not(id: resource).first
|
21
20
|
|
22
21
|
if existing.present?
|
23
22
|
redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(existing.cpd_cycle, existing, existing.next_step)
|
@@ -44,17 +43,16 @@ module Effective
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def permitted_params
|
46
|
+
model = (params.key?(:effective_cpd_statement) ? :effective_cpd_statement : :cpd_statement)
|
47
47
|
case step
|
48
48
|
when :start
|
49
|
-
params.require(
|
49
|
+
params.require(model).permit(:current_step)
|
50
50
|
when :activities
|
51
|
-
params.require(
|
51
|
+
params.require(model).permit(:current_step)
|
52
52
|
when :agreements
|
53
|
-
params.require(
|
54
|
-
:current_step, :confirm_read, :confirm_factual, files: []
|
55
|
-
)
|
53
|
+
params.require(model).permit(:current_step, :confirm_read, :confirm_factual, files: [])
|
56
54
|
when :submit
|
57
|
-
params.require(
|
55
|
+
params.require(model).permit(:current_step, :confirm_readonly)
|
58
56
|
when :complete
|
59
57
|
raise('unexpected post to complete')
|
60
58
|
else
|
@@ -10,7 +10,7 @@ class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable
|
|
10
10
|
col :available_date, label: 'Available'
|
11
11
|
|
12
12
|
col :required_score, label: 'Required' do |cpd_cycle|
|
13
|
-
cpd_statement =
|
13
|
+
cpd_statement = EffectiveCpd.CpdStatement.new(cpd_cycle: cpd_cycle, user: current_user)
|
14
14
|
cpd_score(cpd_statement.required_score || cpd_statement.targeted_score)
|
15
15
|
end
|
16
16
|
|
@@ -27,7 +27,7 @@ class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable
|
|
27
27
|
|
28
28
|
collection do
|
29
29
|
raise('expected a current_user') unless current_user.present?
|
30
|
-
completed =
|
30
|
+
completed = EffectiveCpd.CpdStatement.completed.where(user: current_user)
|
31
31
|
Effective::CpdCycle.available.where.not(id: completed.select('cpd_cycle_id as id'))
|
32
32
|
end
|
33
33
|
|
@@ -27,7 +27,8 @@ class EffectiveCpdCompletedStatementsDatatable < Effective::Datatable
|
|
27
27
|
collection do
|
28
28
|
raise('expected a current_user') unless current_user.present?
|
29
29
|
user = (current_user.class.find(attributes[:user_id]) if attributes[:user_id])
|
30
|
-
|
30
|
+
|
31
|
+
EffectiveCpd.CpdStatement.completed.where(user: user || current_user).includes(:cpd_cycle)
|
31
32
|
end
|
32
33
|
|
33
34
|
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# EffectiveCpdStatement
|
4
|
+
#
|
5
|
+
# Mark your owner model with effective_cpd_statement to get all the includes
|
6
|
+
|
7
|
+
module EffectiveCpdStatement
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
module Base
|
11
|
+
def effective_cpd_statement
|
12
|
+
include ::EffectiveCpdStatement
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module ClassMethods
|
17
|
+
def effective_cpd_statement?; true; end
|
18
|
+
end
|
19
|
+
|
20
|
+
included do
|
21
|
+
acts_as_tokened
|
22
|
+
|
23
|
+
acts_as_wizard(
|
24
|
+
start: 'Start',
|
25
|
+
activities: 'Enter Activities',
|
26
|
+
agreements: 'Sign Agreements',
|
27
|
+
submit: 'Confirm & Submit',
|
28
|
+
complete: 'Complete'
|
29
|
+
)
|
30
|
+
|
31
|
+
log_changes(except: :wizard_steps) if respond_to?(:log_changes)
|
32
|
+
|
33
|
+
has_many_attached :files
|
34
|
+
|
35
|
+
attr_accessor :current_user
|
36
|
+
attr_accessor :current_step
|
37
|
+
|
38
|
+
# App scoped
|
39
|
+
belongs_to :user, polymorphic: true
|
40
|
+
|
41
|
+
# Effective Namespace
|
42
|
+
belongs_to :cpd_cycle, class_name: 'Effective::CpdCycle'
|
43
|
+
|
44
|
+
has_many :cpd_statement_activities, -> { order(:id) }, inverse_of: :cpd_statement, dependent: :destroy, class_name: 'Effective::CpdStatementActivity'
|
45
|
+
accepts_nested_attributes_for :cpd_statement_activities
|
46
|
+
|
47
|
+
effective_resource do
|
48
|
+
score :integer
|
49
|
+
|
50
|
+
confirm_read :boolean
|
51
|
+
confirm_factual :boolean
|
52
|
+
confirm_readonly :boolean
|
53
|
+
|
54
|
+
submitted_at :datetime, permitted: false
|
55
|
+
|
56
|
+
# Acts as tokened
|
57
|
+
token :string, permitted: false
|
58
|
+
|
59
|
+
# Acts as Wizard
|
60
|
+
wizard_steps :text, permitted: false
|
61
|
+
|
62
|
+
timestamps
|
63
|
+
end
|
64
|
+
|
65
|
+
scope :deep, -> { includes(:cpd_cycle, :user, cpd_statement_activities: [:files_attachments, :cpd_category, :original, cpd_activity: [:rich_text_body]]) }
|
66
|
+
scope :sorted, -> { order(:cpd_cycle_id) }
|
67
|
+
|
68
|
+
scope :draft, -> { where(submitted_at: nil) }
|
69
|
+
scope :completed, -> { where.not(submitted_at: nil) }
|
70
|
+
|
71
|
+
before_validation(if: -> { new_record? }) do
|
72
|
+
self.user ||= current_user
|
73
|
+
self.score ||= 0
|
74
|
+
end
|
75
|
+
|
76
|
+
validate(if: -> { completed? }) do
|
77
|
+
min = required_score() || 0.0
|
78
|
+
self.errors.add(:score, "must be #{min} or greater to submit a statement") if score < min
|
79
|
+
end
|
80
|
+
|
81
|
+
with_options(if: -> { current_step == :agreements }) do
|
82
|
+
validates :confirm_read, acceptance: true
|
83
|
+
validates :confirm_factual, acceptance: true
|
84
|
+
end
|
85
|
+
|
86
|
+
with_options(if: -> { current_step == :submit}) do
|
87
|
+
validates :confirm_readonly, acceptance: true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def to_s
|
92
|
+
cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement'
|
93
|
+
end
|
94
|
+
|
95
|
+
def import!(date: nil)
|
96
|
+
date ||= Time.zone.now
|
97
|
+
|
98
|
+
wizard_steps[:start] ||= date
|
99
|
+
wizard_steps[:activities] ||= date
|
100
|
+
cpd_statement_activities.each { |activity| activity.importing = true }
|
101
|
+
|
102
|
+
save!
|
103
|
+
end
|
104
|
+
|
105
|
+
# This is the review step where they click Submit Ballot
|
106
|
+
def submit!
|
107
|
+
wizard_steps[:complete] ||= Time.zone.now
|
108
|
+
|
109
|
+
update!(submitted_at: Time.zone.now)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Called by admin only. This is an exceptional action
|
113
|
+
def unsubmit!
|
114
|
+
update!(wizard_steps: {}, submitted_at: nil, confirm_readonly: nil)
|
115
|
+
end
|
116
|
+
|
117
|
+
def in_progress?
|
118
|
+
submitted_at.blank?
|
119
|
+
end
|
120
|
+
|
121
|
+
def completed?
|
122
|
+
submitted_at.present?
|
123
|
+
end
|
124
|
+
alias_method :submitted?, :completed?
|
125
|
+
|
126
|
+
def required_score
|
127
|
+
required_by_cycle = cpd_cycle&.required_score
|
128
|
+
required_by_user = user.cpd_statement_required_score(self) if user.respond_to?(:cpd_statement_required_score)
|
129
|
+
|
130
|
+
[required_by_cycle, required_by_user].compact.max
|
131
|
+
end
|
132
|
+
|
133
|
+
def targeted_score
|
134
|
+
targeted_by_cycle = cpd_cycle&.targeted_score
|
135
|
+
targeted_by_user = user.cpd_statement_targeted_score(self) if user.respond_to?(:cpd_statement_targeted_score)
|
136
|
+
|
137
|
+
[targeted_by_cycle, targeted_by_user].compact.max
|
138
|
+
end
|
139
|
+
|
140
|
+
def carry_forward
|
141
|
+
cpd_statement_activities.sum { |activity| activity.carry_forward || BigDecimal(0) }.to_d
|
142
|
+
end
|
143
|
+
|
144
|
+
# {category_id => 20, category_id => 15}
|
145
|
+
def score_per_category
|
146
|
+
@score_per_category ||= Hash.new(BigDecimal(0)).tap do |scores|
|
147
|
+
cpd_statement_activities.each { |activity| scores[activity.cpd_category_id] += activity.score.to_d }
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
@@ -13,7 +13,10 @@ module EffectiveCpdUser
|
|
13
13
|
end
|
14
14
|
|
15
15
|
included do
|
16
|
-
|
16
|
+
# App Scoped
|
17
|
+
has_many :cpd_statements, -> { order(:cpd_cycle_id) }, inverse_of: :user
|
18
|
+
|
19
|
+
# Effective
|
17
20
|
has_many :cpd_audits, -> { Effective::CpdAudit.sorted }, inverse_of: :user, class_name: 'Effective::CpdAudit'
|
18
21
|
has_many :cpd_audit_reviews, -> { Effective::CpdAuditReview.sorted }, inverse_of: :user, class_name: 'Effective::CpdAuditReview'
|
19
22
|
|
@@ -4,10 +4,10 @@ module Effective
|
|
4
4
|
|
5
5
|
def initialize(user:, from: nil)
|
6
6
|
@cycles = CpdCycle.deep.sorted.all
|
7
|
-
@statements = CpdStatement.deep.where(user: user).sorted.all
|
7
|
+
@statements = EffectiveCpd.CpdStatement.deep.where(user: user).sorted.all
|
8
8
|
|
9
9
|
if from.present?
|
10
|
-
raise('expected from to be a CpdStatement') unless from.
|
10
|
+
raise('expected from to be a CpdStatement') unless from.class.respond_to?(:effective_cpd_statement?)
|
11
11
|
@statements = @statements.where('cpd_cycle_id >= ?', from.cpd_cycle_id)
|
12
12
|
end
|
13
13
|
|
@@ -43,7 +43,7 @@ module Effective
|
|
43
43
|
protected
|
44
44
|
|
45
45
|
def save!
|
46
|
-
CpdStatement.transaction do
|
46
|
+
EffectiveCpd.CpdStatement.transaction do
|
47
47
|
@statements.each { |statement| statement.save! }; true
|
48
48
|
end
|
49
49
|
end
|
@@ -1,132 +1,5 @@
|
|
1
1
|
module Effective
|
2
2
|
class CpdStatement < ActiveRecord::Base
|
3
|
-
|
4
|
-
attr_accessor :current_step
|
5
|
-
|
6
|
-
belongs_to :cpd_cycle
|
7
|
-
belongs_to :user, polymorphic: true
|
8
|
-
|
9
|
-
has_many :cpd_statement_activities, -> { order(:id) }, inverse_of: :cpd_statement, dependent: :destroy
|
10
|
-
accepts_nested_attributes_for :cpd_statement_activities
|
11
|
-
|
12
|
-
has_many_attached :files
|
13
|
-
|
14
|
-
if respond_to?(:log_changes)
|
15
|
-
log_changes(except: [:wizard_steps])
|
16
|
-
end
|
17
|
-
|
18
|
-
acts_as_tokened
|
19
|
-
|
20
|
-
acts_as_wizard(
|
21
|
-
start: 'Start',
|
22
|
-
activities: 'Enter Activities',
|
23
|
-
agreements: 'Sign Agreements',
|
24
|
-
submit: 'Confirm & Submit',
|
25
|
-
complete: 'Complete'
|
26
|
-
)
|
27
|
-
|
28
|
-
effective_resource do
|
29
|
-
score :integer
|
30
|
-
|
31
|
-
confirm_read :boolean
|
32
|
-
confirm_factual :boolean
|
33
|
-
confirm_readonly :boolean
|
34
|
-
|
35
|
-
submitted_at :datetime, permitted: false
|
36
|
-
|
37
|
-
# Acts as tokened
|
38
|
-
token :string, permitted: false
|
39
|
-
|
40
|
-
# Acts as Wizard
|
41
|
-
wizard_steps :text, permitted: false
|
42
|
-
|
43
|
-
timestamps
|
44
|
-
end
|
45
|
-
|
46
|
-
scope :deep, -> { includes(:cpd_cycle, :user, cpd_statement_activities: [:files_attachments, :cpd_category, :original, cpd_activity: [:rich_text_body]]) }
|
47
|
-
scope :sorted, -> { order(:cpd_cycle_id) }
|
48
|
-
|
49
|
-
scope :draft, -> { where(submitted_at: nil) }
|
50
|
-
scope :completed, -> { where.not(submitted_at: nil) }
|
51
|
-
|
52
|
-
before_validation(if: -> { new_record? }) do
|
53
|
-
self.user ||= current_user
|
54
|
-
self.score ||= 0
|
55
|
-
end
|
56
|
-
|
57
|
-
validate(if: -> { completed? }) do
|
58
|
-
min = required_score() || 0.0
|
59
|
-
self.errors.add(:score, "must be #{min} or greater to submit a statement") if score < min
|
60
|
-
end
|
61
|
-
|
62
|
-
with_options(if: -> { current_step == :agreements }) do
|
63
|
-
validates :confirm_read, acceptance: true
|
64
|
-
validates :confirm_factual, acceptance: true
|
65
|
-
end
|
66
|
-
|
67
|
-
with_options(if: -> { current_step == :submit}) do
|
68
|
-
validates :confirm_readonly, acceptance: true
|
69
|
-
end
|
70
|
-
|
71
|
-
def to_s
|
72
|
-
cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement'
|
73
|
-
end
|
74
|
-
|
75
|
-
def import!(date: nil)
|
76
|
-
date ||= Time.zone.now
|
77
|
-
|
78
|
-
wizard_steps[:start] ||= date
|
79
|
-
wizard_steps[:activities] ||= date
|
80
|
-
cpd_statement_activities.each { |activity| activity.importing = true }
|
81
|
-
|
82
|
-
save!
|
83
|
-
end
|
84
|
-
|
85
|
-
# This is the review step where they click Submit Ballot
|
86
|
-
def submit!
|
87
|
-
wizard_steps[:complete] ||= Time.zone.now
|
88
|
-
|
89
|
-
update!(submitted_at: Time.zone.now)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Called by admin only. This is an exceptional action
|
93
|
-
def unsubmit!
|
94
|
-
update!(wizard_steps: {}, submitted_at: nil, confirm_readonly: nil)
|
95
|
-
end
|
96
|
-
|
97
|
-
def in_progress?
|
98
|
-
submitted_at.blank?
|
99
|
-
end
|
100
|
-
|
101
|
-
def completed?
|
102
|
-
submitted_at.present?
|
103
|
-
end
|
104
|
-
alias_method :submitted?, :completed?
|
105
|
-
|
106
|
-
def required_score
|
107
|
-
required_by_cycle = cpd_cycle&.required_score
|
108
|
-
required_by_user = user.cpd_statement_required_score(self) if user.respond_to?(:cpd_statement_required_score)
|
109
|
-
|
110
|
-
[required_by_cycle, required_by_user].compact.max
|
111
|
-
end
|
112
|
-
|
113
|
-
def targeted_score
|
114
|
-
targeted_by_cycle = cpd_cycle&.targeted_score
|
115
|
-
targeted_by_user = user.cpd_statement_targeted_score(self) if user.respond_to?(:cpd_statement_targeted_score)
|
116
|
-
|
117
|
-
[targeted_by_cycle, targeted_by_user].compact.max
|
118
|
-
end
|
119
|
-
|
120
|
-
def carry_forward
|
121
|
-
cpd_statement_activities.sum { |activity| activity.carry_forward || BigDecimal(0) }.to_d
|
122
|
-
end
|
123
|
-
|
124
|
-
# {category_id => 20, category_id => 15}
|
125
|
-
def score_per_category
|
126
|
-
@score_per_category ||= Hash.new(BigDecimal(0)).tap do |scores|
|
127
|
-
cpd_statement_activities.each { |activity| scores[activity.cpd_category_id] += activity.score.to_d }
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
3
|
+
effective_cpd_statement
|
131
4
|
end
|
132
5
|
end
|
@@ -11,7 +11,7 @@ module Effective
|
|
11
11
|
belongs_to :cpd_cycle
|
12
12
|
belongs_to :user, polymorphic: true
|
13
13
|
|
14
|
-
belongs_to :original, class_name: 'CpdStatementActivity', optional: true # If this is a Carryover, the original_statement_activity will be set.
|
14
|
+
belongs_to :original, class_name: 'Effective::CpdStatementActivity', optional: true # If this is a Carryover, the original_statement_activity will be set.
|
15
15
|
#has_many :carried, class_name: 'CpdStatementActivity', foreign_key: 'original_id', dependent: :delete_all
|
16
16
|
|
17
17
|
has_many_attached :files
|
@@ -41,8 +41,8 @@ module Effective
|
|
41
41
|
scope :deep, -> { includes(:cpd_statement, :cpd_category, :cpd_activity, :original) }
|
42
42
|
scope :sorted, -> { order(:id) }
|
43
43
|
|
44
|
-
scope :draft, -> { where(cpd_statement_id: CpdStatement.draft) }
|
45
|
-
scope :completed, -> { where(cpd_statement_id: CpdStatement.completed) }
|
44
|
+
scope :draft, -> { where(cpd_statement_id: EffectiveCpd.CpdStatement.draft) }
|
45
|
+
scope :completed, -> { where(cpd_statement_id: EffectiveCpd.CpdStatement.completed) }
|
46
46
|
|
47
47
|
validates :original, presence: true, if: -> { (carry_over || 0) > 0 }
|
48
48
|
validates :description, presence: true
|
@@ -6,16 +6,16 @@
|
|
6
6
|
%p
|
7
7
|
= cpd_statement_activity
|
8
8
|
%br
|
9
|
-
%small.text-muted= rule.credit_description
|
9
|
+
%small.text-muted= rule.credit_description.to_s
|
10
10
|
|
11
11
|
- if cpd_activity.body.present?
|
12
|
-
.mb-3= cpd_activity.body
|
12
|
+
.mb-3= cpd_activity.body.to_s
|
13
13
|
|
14
14
|
- if cpd_statement_activity.is_carry_over?
|
15
15
|
%p
|
16
16
|
%strong Carried Forward From
|
17
17
|
%br
|
18
|
-
= cpd_statement_activity.original.cpd_statement.cpd_cycle
|
18
|
+
= cpd_statement_activity.original.cpd_statement.cpd_cycle.to_s
|
19
19
|
|
20
20
|
.row.mb-3
|
21
21
|
.col-sm-8
|
@@ -63,4 +63,4 @@
|
|
63
63
|
%p
|
64
64
|
%strong Description
|
65
65
|
%br
|
66
|
-
= cpd_statement_activity.description
|
66
|
+
= simple_format(cpd_statement_activity.description.to_s.presence || '-')
|
@@ -10,18 +10,18 @@
|
|
10
10
|
%h3= activity
|
11
11
|
|
12
12
|
- if activity.body.present?
|
13
|
-
= activity.body
|
13
|
+
= activity.body.to_s
|
14
14
|
|
15
15
|
- if cpd_statement_activity.is_carry_over?
|
16
16
|
.alert.alert-warning
|
17
17
|
This activity is read-only because it was carried forward from
|
18
|
-
= cpd_statement_activity.original.cpd_statement.cpd_cycle
|
18
|
+
= cpd_statement_activity.original.cpd_statement.cpd_cycle.to_s
|
19
19
|
|
20
20
|
.row.my-3
|
21
21
|
.col-8
|
22
22
|
%strong #{cpd_credits_label.capitalize} Calculation
|
23
23
|
%br
|
24
|
-
= rule.credit_description
|
24
|
+
= rule.credit_description.to_s
|
25
25
|
|
26
26
|
.col-2.text-center
|
27
27
|
- if f.object.persisted?
|
@@ -19,13 +19,13 @@
|
|
19
19
|
|
20
20
|
.mb-3
|
21
21
|
%strong Description
|
22
|
-
= category.body
|
22
|
+
= category.body.to_s
|
23
23
|
|
24
24
|
.mb-3
|
25
25
|
%strong #{cpd_credits_label.titleize} Calculation
|
26
26
|
%br
|
27
|
-
= rule.category_credit_description
|
28
|
-
= rule.credit_description
|
27
|
+
= rule.category_credit_description.to_s
|
28
|
+
= rule.credit_description.to_s
|
29
29
|
|
30
30
|
%div
|
31
31
|
%strong Select an Activity to Continue
|
@@ -1,13 +1,20 @@
|
|
1
1
|
= render('layout') do
|
2
2
|
%h1= resource.cpd_cycle
|
3
3
|
|
4
|
+
- raise('expected a submitted cpd_statement') unless resource.submitted_at.present?
|
5
|
+
|
6
|
+
.alert.alert-warning.mb-4
|
7
|
+
Successfully submitted on #{resource.submitted_at.strftime('%F')}.
|
8
|
+
|
4
9
|
- if resource.cpd_cycle.all_steps_content.present?
|
5
10
|
.mb-2= resource.cpd_cycle.all_steps_content.to_s
|
6
11
|
|
7
12
|
- if resource.cpd_cycle.complete_content.present?
|
8
13
|
.mb-2= resource.cpd_cycle.complete_content.to_s
|
9
14
|
|
10
|
-
=
|
15
|
+
= link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
|
16
|
+
|
17
|
+
= render('effective/cpd_statements/cpd_statement', cpd_statement: resource)
|
11
18
|
|
12
19
|
%hr
|
13
|
-
|
20
|
+
= link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary'
|
@@ -7,7 +7,7 @@
|
|
7
7
|
- if resource.cpd_cycle.submit_content.present?
|
8
8
|
.mb-2= resource.cpd_cycle.submit_content.to_s
|
9
9
|
|
10
|
-
= render(resource)
|
10
|
+
= render('effective/cpd_statements/cpd_statement', cpd_statement: resource)
|
11
11
|
|
12
12
|
%p= link_to 'Change Activities', wizard_path(:activities)
|
13
13
|
|
data/config/effective_cpd.rb
CHANGED
@@ -29,7 +29,12 @@ EffectiveCpd.setup do |config|
|
|
29
29
|
admin: 'admin'
|
30
30
|
}
|
31
31
|
|
32
|
+
# CPD Class Settings
|
33
|
+
# Configure the class responsible for the cpd statements.
|
34
|
+
# config.cpd_statement_class_name = 'Effective::CpdStatement'
|
35
|
+
|
32
36
|
# Program label settings
|
37
|
+
config.program_label = 'CPD' # CPD or MCE
|
33
38
|
config.cycle_label = 'year' # 'cycle', 'season'
|
34
39
|
config.credit_label = 'credit' # 'credit', 'PDH', 'PDU', 'CCC'
|
35
40
|
|
data/lib/effective_cpd/engine.rb
CHANGED
data/lib/effective_cpd.rb
CHANGED
@@ -14,8 +14,9 @@ module EffectiveCpd
|
|
14
14
|
:cpd_audit_level_questions_table_name, :cpd_audit_level_question_options_table_name,
|
15
15
|
:cpd_audits_table_name, :cpd_audit_responses_table_name, :cpd_audit_response_options_table_name,
|
16
16
|
:cpd_audit_reviews_table_name, :cpd_audit_review_items_table_name,
|
17
|
-
:cycle_label, :credit_label, :layout, :auditee_user_scope, :audit_reviewer_user_scope,
|
18
|
-
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject, :use_effective_email_templates
|
17
|
+
:program_label, :cycle_label, :credit_label, :layout, :auditee_user_scope, :audit_reviewer_user_scope,
|
18
|
+
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject, :use_effective_email_templates,
|
19
|
+
:cpd_statement_class_name
|
19
20
|
]
|
20
21
|
end
|
21
22
|
|
@@ -25,4 +26,8 @@ module EffectiveCpd
|
|
25
26
|
mailer&.constantize || Effective::CpdMailer
|
26
27
|
end
|
27
28
|
|
29
|
+
def self.CpdStatement
|
30
|
+
cpd_statement_class_name&.constantize || Effective::CpdStatement
|
31
|
+
end
|
32
|
+
|
28
33
|
end
|
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.
|
4
|
+
version: 0.6.0
|
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-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -216,6 +216,7 @@ files:
|
|
216
216
|
- app/helpers/effective_cpd_audits_helper.rb
|
217
217
|
- app/helpers/effective_cpd_helper.rb
|
218
218
|
- app/mailers/effective/cpd_mailer.rb
|
219
|
+
- app/models/concerns/effective_cpd_statement.rb
|
219
220
|
- app/models/concerns/effective_cpd_user.rb
|
220
221
|
- app/models/effective/cpd_activity.rb
|
221
222
|
- app/models/effective/cpd_audit.rb
|