effective_cpd 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/models/concerns/effective_cpd_audit.rb +6 -3
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/tasks/effective_cpd_tasks.rake +23 -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: c0c18c1af80311c6e645ea9f7846924dd85a35e4ed11605f0791d1f9c7e73511
|
4
|
+
data.tar.gz: a216123cafd45efafcd9f85e53230799cb6a051006e7307dd7a629091cfa6082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f18ca3ad8b0b07cd5a60aa1435e047f6ec9c80d03f361c23024753202cecb1720cf773af88b1232732ea1f5b2c814554ce0104ff39a818746e7ff6399113f8
|
7
|
+
data.tar.gz: 2347e808fc551c592bd09c902d5e73bf4c2f1accb2c2ad66a0fc4f6b4cdec0671ef316931d0072259e9d7a584ae5a9e1b2302a73c13616569f5f7f48d71d19d1
|
data/README.md
CHANGED
@@ -167,6 +167,14 @@ def cpd_statement_required_score(cpd_statement)
|
|
167
167
|
end
|
168
168
|
```
|
169
169
|
|
170
|
+
## Rake Tasks
|
171
|
+
|
172
|
+
You can use
|
173
|
+
|
174
|
+
`bundle exec rake effective_cpd:notify_auditees`
|
175
|
+
|
176
|
+
to send the cpd_audit_opened notification to all opened (but not yet started) auditees.
|
177
|
+
|
170
178
|
## Authorization
|
171
179
|
|
172
180
|
All authorization checks are handled via the effective_resources gem found in the `config/initializers/effective_resources.rb` file.
|
@@ -240,9 +240,7 @@ module EffectiveCpdAudit
|
|
240
240
|
before_save(if: -> { submitted? }) { try_complete! }
|
241
241
|
before_save(if: -> { completed? }) { try_review! }
|
242
242
|
|
243
|
-
after_commit(on: :create)
|
244
|
-
send_email(:cpd_audit_opened)
|
245
|
-
end
|
243
|
+
after_commit(on: :create) { notify! }
|
246
244
|
|
247
245
|
def dynamic_wizard_steps
|
248
246
|
cpd_audit_level.cpd_audit_level_sections.each_with_object({}) do |section, h|
|
@@ -413,6 +411,11 @@ module EffectiveCpdAudit
|
|
413
411
|
cpd_audit_response ||= cpd_audit_responses.build(cpd_audit: self, cpd_audit_level_question: cpd_audit_level_question)
|
414
412
|
end
|
415
413
|
|
414
|
+
def notify!
|
415
|
+
send_email(:cpd_audit_opened)
|
416
|
+
true
|
417
|
+
end
|
418
|
+
|
416
419
|
# Auditee wizard action
|
417
420
|
def start!
|
418
421
|
started!
|
@@ -1,6 +1,28 @@
|
|
1
|
-
# bundle exec rake effective_cpd:seed
|
2
1
|
namespace :effective_cpd do
|
2
|
+
|
3
|
+
# bundle exec rake effective_cpd:seed
|
3
4
|
task seed: :environment do
|
4
5
|
load "#{__dir__}/../../db/seeds.rb"
|
5
6
|
end
|
7
|
+
|
8
|
+
# bundle exec rake effective_cpd:notify_auditees
|
9
|
+
desc 'Send cpd_audit_opened email notifications for effective cpd'
|
10
|
+
task notify_auditees: :environment do
|
11
|
+
audits = EffectiveCpd.CpdAudit.opened.sorted
|
12
|
+
|
13
|
+
audits.find_each do |audit|
|
14
|
+
begin
|
15
|
+
audit.notify!
|
16
|
+
puts "Sent #{audit} notification to #{audit.user.email}"
|
17
|
+
rescue => e
|
18
|
+
if defined?(ExceptionNotifier)
|
19
|
+
ExceptionNotifier.notify_exception(e, data: { audit_id: audit.id })
|
20
|
+
end
|
21
|
+
|
22
|
+
puts "Error with audit #{auditee.id}: #{e.errors.inspect}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
puts 'All done'
|
27
|
+
end
|
6
28
|
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.2.
|
4
|
+
version: 1.2.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-
|
11
|
+
date: 2023-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|