effective_cpd 0.4.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/effective_cpd_user.rb +14 -1
- data/app/models/effective/cpd_cycle.rb +4 -0
- data/app/models/effective/cpd_statement.rb +10 -0
- data/app/models/effective/cpd_statement_activity.rb +2 -1
- data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +6 -2
- data/app/views/admin/cpd_cycles/_form_cpd_rules.html.haml +4 -2
- data/app/views/effective/cpd/_dashboard.html.haml +39 -0
- data/lib/effective_cpd/version.rb +1 -1
- 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: 7a4a0dc542b4aab7be7e662920d7d9c8c01b365debd9ba594bb6ffe92f4f3ccc
|
4
|
+
data.tar.gz: cd1039d075de6ca26ee36fc38c5790599e1d6761aa1fe0e5fc9791e4294709cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb17b6984b76cc262edf4f85f898dd1b09e3338b388e178edb12068bc8eede3501b6314186a97fa28ecfbc81380df81d6316865321fe93ccf5d068ecbf7b5dd
|
7
|
+
data.tar.gz: 0c514c94d8ff831ebdbd7431d00bd07e7f7b452721c0cbb17958381ace13e2e5426c3c8c73ba797d47e4c8c7fc2d69ad23061ff28d01da4c471ecfbc54cded6d
|
@@ -13,9 +13,11 @@ module EffectiveCpdUser
|
|
13
13
|
end
|
14
14
|
|
15
15
|
included do
|
16
|
-
has_many :cpd_statements, -> { Effective::CpdStatement.sorted }, class_name: 'Effective::CpdStatement'
|
16
|
+
has_many :cpd_statements, -> { Effective::CpdStatement.sorted }, inverse_of: :user, class_name: 'Effective::CpdStatement'
|
17
17
|
has_many :cpd_audits, -> { Effective::CpdAudit.sorted }, inverse_of: :user, class_name: 'Effective::CpdAudit'
|
18
18
|
has_many :cpd_audit_reviews, -> { Effective::CpdAuditReview.sorted }, inverse_of: :user, class_name: 'Effective::CpdAuditReview'
|
19
|
+
|
20
|
+
accepts_nested_attributes_for :cpd_statements
|
19
21
|
end
|
20
22
|
|
21
23
|
def cpd_statement_required_score(cpd_statement)
|
@@ -26,6 +28,17 @@ module EffectiveCpdUser
|
|
26
28
|
true
|
27
29
|
end
|
28
30
|
|
31
|
+
def cpd_statement(cpd_cycle:)
|
32
|
+
raise('expected an Effective::CpdCycle') unless cpd_cycle.class.respond_to?(:effective_cpd_cpd_cycle?)
|
33
|
+
cpd_statements.find { |cpd_statement| cpd_statement.cpd_cycle_id == cpd_cycle.id }
|
34
|
+
end
|
35
|
+
|
36
|
+
# Find or build
|
37
|
+
def build_cpd_statement(cpd_cycle:)
|
38
|
+
raise('expected an Effective::CpdCycle') unless cpd_cycle.class.respond_to?(:effective_cpd_cpd_cycle?)
|
39
|
+
cpd_statement(cpd_cycle: cpd_cycle) || cpd_statements.build(cpd_cycle: cpd_cycle)
|
40
|
+
end
|
41
|
+
|
29
42
|
module ClassMethods
|
30
43
|
def effective_cpd_user?; true; end
|
31
44
|
end
|
@@ -72,6 +72,16 @@ module Effective
|
|
72
72
|
cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement'
|
73
73
|
end
|
74
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
|
+
|
75
85
|
# This is the review step where they click Submit Ballot
|
76
86
|
def submit!
|
77
87
|
wizard_steps[:complete] ||= Time.zone.now
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Effective
|
2
2
|
class CpdStatementActivity < ActiveRecord::Base
|
3
3
|
attr_accessor :max_score
|
4
|
+
attr_accessor :importing
|
4
5
|
|
5
6
|
belongs_to :cpd_statement
|
6
7
|
belongs_to :cpd_category
|
@@ -38,7 +39,7 @@ module Effective
|
|
38
39
|
validates :original, presence: true, if: -> { (carry_over || 0) > 0 }
|
39
40
|
validates :description, presence: true
|
40
41
|
|
41
|
-
validate(if: -> { new_record? && cpd_statement.present? }) do
|
42
|
+
validate(if: -> { new_record? && cpd_statement.present? }, unless: -> { importing }) do
|
42
43
|
self.errors.add(:base, "statement has already been completed") if cpd_statement.completed?
|
43
44
|
self.errors.add(:base, "cycle is unavailable") unless cpd_statement.cpd_cycle.available?
|
44
45
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
= effective_form_with(model: [:admin, cpd_audit_level], engine: true) do |f|
|
2
2
|
= f.fields_for :cpd_audit_level_sections, cpd_audit_level_section do |fas|
|
3
|
-
|
4
|
-
|
3
|
+
- if defined?(EffectiveArticleEditor)
|
4
|
+
= fas.article_editor :top_content
|
5
|
+
= fas.article_editor :bottom_content
|
6
|
+
- else
|
7
|
+
= fas.rich_text_area :top_content
|
8
|
+
= fas.rich_text_area :bottom_content
|
5
9
|
|
6
10
|
= f.submit
|
7
11
|
|
@@ -16,8 +16,10 @@
|
|
16
16
|
= fc.select :cpd_special_rule_ids, cpd_cycle.cpd_special_rules, multiple: true,
|
17
17
|
label: 'Special Rules', hint: "Special rules operate on more than one category at a time"
|
18
18
|
|
19
|
-
|
20
|
-
hint: "A description of the maximum #{cpd_credits_label} and carry forward policy of activities for this category"
|
19
|
+
- if defined?(EffectiveArticleEditor)
|
20
|
+
= fc.article_editor :category_credit_description, hint: "A description of the maximum #{cpd_credits_label} and carry forward policy of activities for this category"
|
21
|
+
- else
|
22
|
+
= fc.rich_text_area :category_credit_description, hint: "A description of the maximum #{cpd_credits_label} and carry forward policy of activities for this category"
|
21
23
|
|
22
24
|
= fc.check_box :unavailable, label: "Unavailable in this #{cpd_cycle_label}"
|
23
25
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
%h2 Continuing Professional Development
|
2
|
+
|
3
|
+
- # Auditee datatables (4)
|
4
|
+
- auditing = EffectiveCpdAvailableAuditsDatatable.new(self)
|
5
|
+
- if auditing.present?
|
6
|
+
.mt-4
|
7
|
+
%p You have been selected for audit:
|
8
|
+
= render_datatable(auditing, simple: true)
|
9
|
+
|
10
|
+
- audited = EffectiveCpdCompletedAuditsDatatable.new(self)
|
11
|
+
- if audited.present?
|
12
|
+
.mt-4
|
13
|
+
%p You have completed these past audits:
|
14
|
+
= render_datatable(audited, simple: true)
|
15
|
+
|
16
|
+
- available = EffectiveCpdAvailableCyclesDatatable.new(self)
|
17
|
+
- if available.present?
|
18
|
+
.mt-4
|
19
|
+
%p Please submit a CPD statement for the following available #{cpd_cycles_label}:
|
20
|
+
= render_datatable(available, simple: true)
|
21
|
+
|
22
|
+
- completed = EffectiveCpdCompletedStatementsDatatable.new(self)
|
23
|
+
- if completed.present?
|
24
|
+
.mt-4
|
25
|
+
%p You have completed these past statements:
|
26
|
+
= render_datatable(completed, simple: true)
|
27
|
+
|
28
|
+
- # Auditor / Audit reviewer datatables (2)
|
29
|
+
- reviewing = EffectiveCpdAvailableAuditReviewsDatatable.new(self)
|
30
|
+
- if reviewing.present?
|
31
|
+
.mt-4
|
32
|
+
%p You have been selected to assess the following audits:
|
33
|
+
= render_datatable(reviewing, simple: true)
|
34
|
+
|
35
|
+
- reviewed = EffectiveCpdCompletedAuditReviewsDatatable.new(self)
|
36
|
+
- if reviewed.present?
|
37
|
+
.mt-4
|
38
|
+
%p You have completed these past audit assessments:
|
39
|
+
= render_datatable(reviewed, simple: true)
|
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.
|
4
|
+
version: 0.4.3
|
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-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -261,6 +261,7 @@ files:
|
|
261
261
|
- app/views/admin/cpd_cycles/_form_cpd_special_rules.html.haml
|
262
262
|
- app/views/admin/cpd_special_rules/_form.html.haml
|
263
263
|
- app/views/admin/cpd_statements/_cpd_statement.html.haml
|
264
|
+
- app/views/effective/cpd/_dashboard.html.haml
|
264
265
|
- app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml
|
265
266
|
- app/views/effective/cpd_audit_responses/_cpd_audit_response.html.haml
|
266
267
|
- app/views/effective/cpd_audit_responses/_fields.html.haml
|