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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eed65d1a331a6a09e8f5435d1f200f646680773b271d0000358438c09122d29e
4
- data.tar.gz: 117455812ab24c1d74a19ba95ca4eccfebc3d2085094c394b272c47464ca9907
3
+ metadata.gz: c0c18c1af80311c6e645ea9f7846924dd85a35e4ed11605f0791d1f9c7e73511
4
+ data.tar.gz: a216123cafd45efafcd9f85e53230799cb6a051006e7307dd7a629091cfa6082
5
5
  SHA512:
6
- metadata.gz: fa0036e716e1c6b8871d4f149eb8e3f5c372d32888e8c4fd21c5bcda4763adb2eb069e4eaa77ff210172d4dcfff3c746fcc86c5e8720f83a133aa238a4481eb7
7
- data.tar.gz: baca0a12db533c7f1fc5dbb1ba9f1ae180b44aa18f30aa0bd360cff51898a4d1e24028f5f30a763e1cd01448bcabff2c3a5a533f6410dbfd0b6eece12ab32f40
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) do
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,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
@@ -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.3
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-01-27 00:00:00.000000000 Z
11
+ date: 2023-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails