effective_cpd 1.6.5 → 1.7.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/README.md +20 -4
- data/app/mailers/effective/cpd_mailer.rb +4 -2
- data/app/models/concerns/effective_cpd_audit.rb +4 -0
- data/app/models/concerns/effective_cpd_statement.rb +14 -0
- data/app/models/effective/cpd_rule.rb +9 -2
- data/app/views/effective/cpd_mailer/cpd_audit_closed.liquid +4 -0
- data/lib/effective_cpd/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502981a987e34f6022514dacb5bc5bbcc9f07a3290b607932c97f057a9a73ed0
|
4
|
+
data.tar.gz: 47d5f95962bdede3f7590d956c48fc5bded7fd1db9e3f2127400cf049f8f47d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8368077022f74fd35ea5d2a33daa93f88315bbf7400f42ff4c9ff93144c361ac6f827740e6a7ef232520b1daae9fe3c00d5622d7779b22da10be26cade9c0577
|
7
|
+
data.tar.gz: 1ae3852f5a4cce0e49744e464f1fa912602496b440fcb8f3aaec8173fc768df1e85c85a81c3058ff41c26c044d3c0ada2d844970cc94ebe018e7b62787578f26
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Continuing professional development.
|
4
4
|
|
5
|
-
An admin creates a set of categories,
|
5
|
+
An admin creates a set of categories, activities and rules. User enters number of hours or work done to have a scored statement. Audits.
|
6
6
|
|
7
7
|
Works with action_text for content bodies, and active_storage for file uploads.
|
8
8
|
|
@@ -93,7 +93,7 @@ Use the following datatables to display to your user their statements and audits
|
|
93
93
|
= render_datatable(reviewed, simple: true)
|
94
94
|
```
|
95
95
|
|
96
|
-
On the Admin::Users#edit
|
96
|
+
On the `Admin::Users#edit`, you can use the following datatables as well:
|
97
97
|
|
98
98
|
```haml
|
99
99
|
%h2 CPD Statements
|
@@ -138,7 +138,7 @@ Once all these 3 areas have been configured, users can submit statements and aud
|
|
138
138
|
|
139
139
|
You can specify the required score in the CPD Cycle.
|
140
140
|
|
141
|
-
You can also
|
141
|
+
You can also programmatically do it. Add the following to your user class.
|
142
142
|
|
143
143
|
```
|
144
144
|
# This is an ActiveRecord concern to add the has_many :cpd_statements
|
@@ -167,6 +167,22 @@ def cpd_statement_required_score(cpd_statement)
|
|
167
167
|
end
|
168
168
|
```
|
169
169
|
|
170
|
+
## Custom Score Rounding
|
171
|
+
|
172
|
+
In your `effective_cpd_statement` model you can override the `#round_amount` method to perform
|
173
|
+
specific rounding on the score that will be applied to `amount` and `amount2`.
|
174
|
+
|
175
|
+
Example:
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
# Rounding to the nearest 0.5
|
179
|
+
def round_amount(amount)
|
180
|
+
return 0 if amount.blank?
|
181
|
+
|
182
|
+
(amount * 2.0).round / 2.0
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
170
186
|
## Rake Tasks
|
171
187
|
|
172
188
|
You can use
|
@@ -181,7 +197,7 @@ All authorization checks are handled via the effective_resources gem found in th
|
|
181
197
|
|
182
198
|
## Permissions
|
183
199
|
|
184
|
-
The permissions you actually want to define are as follows (using
|
200
|
+
The permissions you actually want to define are as follows (using CanCanCan):
|
185
201
|
|
186
202
|
```ruby
|
187
203
|
# Regular signed up user. Guest users not supported.
|
@@ -216,7 +216,8 @@ module Effective
|
|
216
216
|
title: @cpd_audit.to_s,
|
217
217
|
level: @cpd_audit.cpd_audit_level.to_s,
|
218
218
|
determination: @cpd_audit.determination.to_s,
|
219
|
-
missing_info_reason: @cpd_audit.missing_info_reason.to_s
|
219
|
+
missing_info_reason: @cpd_audit.missing_info_reason.to_s,
|
220
|
+
feedback: @cpd_audit.feedback.to_s,
|
220
221
|
},
|
221
222
|
auditee: {
|
222
223
|
name: @cpd_audit.name,
|
@@ -228,7 +229,8 @@ module Effective
|
|
228
229
|
{
|
229
230
|
review: {
|
230
231
|
title: @cpd_audit_review.to_s,
|
231
|
-
recommendation: @cpd_audit_review.recommendation.to_s
|
232
|
+
recommendation: @cpd_audit_review.recommendation.to_s,
|
233
|
+
feedback: @cpd_audit_review.feedback.to_s,
|
232
234
|
},
|
233
235
|
reviewer: {
|
234
236
|
name: @cpd_audit_review.name,
|
@@ -152,4 +152,18 @@ module EffectiveCpdStatement
|
|
152
152
|
cpd_statement_activities.each { |activity| scores[activity.cpd_category_id] += activity.score.to_d }
|
153
153
|
end
|
154
154
|
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# This method is used in CpdScore#score so it can be overridden to provide a
|
158
|
+
# custom round score calculation.
|
159
|
+
# Any model that is a statement can override this method to provide a custom
|
160
|
+
# round score calculation.
|
161
|
+
#
|
162
|
+
# @param [Decimal] amount
|
163
|
+
#
|
164
|
+
# @return [Decimal] rounded decimal
|
165
|
+
#
|
166
|
+
def round_amount(amount)
|
167
|
+
return amount
|
168
|
+
end
|
155
169
|
end
|
@@ -13,7 +13,7 @@ module Effective
|
|
13
13
|
log_changes(to: :cpd_cycle)
|
14
14
|
end
|
15
15
|
|
16
|
-
# Only permit the words amount, amount2 and any
|
16
|
+
# Only permit the words amount, amount2 and any character 0-9 + - / * . ( )
|
17
17
|
INVALID_FORMULA_CHARS = /[^0-9\+\-\.\/\*\(\)]/
|
18
18
|
|
19
19
|
effective_resource do
|
@@ -111,7 +111,14 @@ module Effective
|
|
111
111
|
|
112
112
|
return cpd_statement_activity.carry_over if cpd_statement_activity.is_carry_over?
|
113
113
|
|
114
|
-
|
114
|
+
# Statements can override the #round_amount method to perform their own
|
115
|
+
# calculations. For example, a statement may round to the nearest 0.5 or
|
116
|
+
# to the nearest 0.25 or to the nearest 0.1.
|
117
|
+
statement = cpd_statement_activity.cpd_statement
|
118
|
+
amount = statement.round_amount(cpd_statement_activity.amount)
|
119
|
+
amount2 = statement.round_amount(cpd_statement_activity.amount2)
|
120
|
+
|
121
|
+
eval_equation(amount: amount, amount2: amount2)
|
115
122
|
end
|
116
123
|
|
117
124
|
private
|
@@ -8,6 +8,10 @@ Your {{ audit.title }} has been closed.
|
|
8
8
|
|
9
9
|
The following determination was made: {{ audit.determination }}
|
10
10
|
|
11
|
+
The following feedback was provided by the reviewer:
|
12
|
+
|
13
|
+
{{ audit.feedback }}
|
14
|
+
|
11
15
|
Please check below for any additional details
|
12
16
|
|
13
17
|
{{ url }}
|
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.7.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-
|
11
|
+
date: 2023-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -206,6 +206,20 @@ dependencies:
|
|
206
206
|
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: psych
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "<"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '4'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "<"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '4'
|
209
223
|
description: Continuing professional development and audits rails engine
|
210
224
|
email:
|
211
225
|
- info@codeandeffect.com
|
@@ -483,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
483
497
|
- !ruby/object:Gem::Version
|
484
498
|
version: '0'
|
485
499
|
requirements: []
|
486
|
-
rubygems_version: 3.
|
500
|
+
rubygems_version: 3.3.7
|
487
501
|
signing_key:
|
488
502
|
specification_version: 4
|
489
503
|
summary: Continuing professional development and audits rails engine
|