effective_cpd 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/datatables/effective_cpd_available_cycles_datatable.rb +3 -4
- data/app/datatables/effective_cpd_completed_statements_datatable.rb +1 -4
- data/app/models/concerns/effective_cpd_user.rb +11 -0
- data/config/locales/effective_cpd.en.yml +10 -3
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/effective_cpd.rb +16 -0
- 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: 1be69d17b3b7602f4ecd79e04ba02da88c72d9cffe84b2a62a89bfb86d9e83ad
|
4
|
+
data.tar.gz: 1e681360aeb11babccd620a4b50517ee76e14c8193256944e0b312da01f4d7c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 818a42d3b8ae3d1b50b4504668a9a981456ac82a7283aa8b41de048c500e584515785fe2f823dad1767ac88ef4f95f85a195d8281618cc6bfbecd267c20a3f87
|
7
|
+
data.tar.gz: 3556315481e1cba1e8510cfb324f5d9f0c53ed62d656991ad9593c07e715eac16e6d19b8bb5bd95e4483ab85e60b257b38fc9cc3c0b7e813cecb11cae979a65d
|
@@ -25,9 +25,8 @@ class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable
|
|
25
25
|
end
|
26
26
|
|
27
27
|
collection do
|
28
|
-
|
29
|
-
|
30
|
-
completed = EffectiveCpd.CpdStatement.completed.where(user: current_user)
|
31
|
-
Effective::CpdCycle.available.where.not(id: completed.select('cpd_cycle_id as id'))
|
28
|
+
completed = EffectiveCpd.CpdStatement.completed.where(user: attributes[:user] || current_user)
|
29
|
+
Effective::CpdCycle.available.where.not(id: completed.select(:cpd_cycle_id))
|
32
30
|
end
|
31
|
+
|
33
32
|
end
|
@@ -26,10 +26,7 @@ class EffectiveCpdCompletedStatementsDatatable < Effective::Datatable
|
|
26
26
|
end
|
27
27
|
|
28
28
|
collection do
|
29
|
-
|
30
|
-
user = (current_user.class.find(attributes[:user_id]) if attributes[:user_id])
|
31
|
-
|
32
|
-
EffectiveCpd.CpdStatement.completed.where(user: user || current_user).includes(:cpd_cycle)
|
29
|
+
EffectiveCpd.CpdStatement.completed.where(user: attributes[:user] || current_user).includes(:cpd_cycle)
|
33
30
|
end
|
34
31
|
|
35
32
|
end
|
@@ -113,6 +113,17 @@ module EffectiveCpdUser
|
|
113
113
|
end.sort_by(&:cpd_cycle_id).reverse
|
114
114
|
end
|
115
115
|
|
116
|
+
# These two are checked by effective memberships for the CPD step
|
117
|
+
def cpd_current_statement_completed?(date: nil)
|
118
|
+
cpd_cycle = EffectiveCpd.current_cpd_cycle(date: date)
|
119
|
+
cpd_cycle.present? && cpd_statement(cpd_cycle: cpd_cycle).try(:completed?)
|
120
|
+
end
|
121
|
+
|
122
|
+
def cpd_previous_statement_completed?(date: nil)
|
123
|
+
cpd_cycle = EffectiveCpd.previous_cpd_cycle(date: date)
|
124
|
+
cpd_cycle.present? && cpd_statement(cpd_cycle: cpd_cycle).try(:completed?)
|
125
|
+
end
|
126
|
+
|
116
127
|
private
|
117
128
|
|
118
129
|
def reject_cpd_target_attributes(atts)
|
@@ -8,21 +8,21 @@ en:
|
|
8
8
|
|
9
9
|
activerecord:
|
10
10
|
models:
|
11
|
-
#
|
11
|
+
# Application namespace
|
12
12
|
cpd_audit: 'CPD Audit'
|
13
13
|
cpd_audit_level: 'CPD Audit Level'
|
14
14
|
cpd_audit_review: 'CPD Audit Review'
|
15
15
|
cpd_bulk_audit: 'Bulk Create CPD Audit Review'
|
16
16
|
cpd_statement: 'CPD Statement'
|
17
17
|
|
18
|
-
#
|
18
|
+
# Effective namespace
|
19
19
|
effective/cpd_cycle: 'CPD Period'
|
20
20
|
effective/cpd_statement_activity: 'CPD Statement Activity'
|
21
21
|
effective/cpd_category: 'CPD Category'
|
22
22
|
effective/cpd_target: 'CPD Target'
|
23
23
|
|
24
24
|
attributes:
|
25
|
-
#
|
25
|
+
# Application namespace
|
26
26
|
cpd_audit:
|
27
27
|
user: 'Auditee'
|
28
28
|
cpd_audit_comments: 'Reviewer Notes'
|
@@ -30,3 +30,10 @@ en:
|
|
30
30
|
cpd_audit_review:
|
31
31
|
user: 'Reviewer'
|
32
32
|
comments: 'Reviewer Notes'
|
33
|
+
|
34
|
+
cpd_statement:
|
35
|
+
cpd_cycle: 'CPD Period'
|
36
|
+
|
37
|
+
# Effective namespace
|
38
|
+
effective/cpd_statement_activity:
|
39
|
+
cpd_cycle: 'CPD Period'
|
data/lib/effective_cpd.rb
CHANGED
@@ -33,6 +33,10 @@ module EffectiveCpd
|
|
33
33
|
cpd_statement_class_name&.constantize || Effective::CpdStatement
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.CpdCycle
|
37
|
+
Effective::CpdCycle
|
38
|
+
end
|
39
|
+
|
36
40
|
def self.CpdAudit
|
37
41
|
cpd_audit_class_name&.constantize || Effective::CpdAudit
|
38
42
|
end
|
@@ -53,4 +57,16 @@ module EffectiveCpd
|
|
53
57
|
defined?(EffectiveMessaging) && !!use_effective_messaging
|
54
58
|
end
|
55
59
|
|
60
|
+
def self.current_cpd_cycle(date: nil)
|
61
|
+
date ||= Time.zone.now
|
62
|
+
cpd_cycles = Effective::CpdCycle.all.reorder(start_at: :asc).all.where('start_at <= ?', date)
|
63
|
+
cpd_cycles.to_a.last
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.previous_cpd_cycle(date: nil)
|
67
|
+
date ||= Time.zone.now
|
68
|
+
cpd_cycles = Effective::CpdCycle.all.reorder(start_at: :asc).all.where('start_at <= ?', date)
|
69
|
+
cpd_cycles.to_a.last(2).first
|
70
|
+
end
|
71
|
+
|
56
72
|
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: 1.6.
|
4
|
+
version: 1.6.4
|
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-04-
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|