effective_cpd 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/cpd_audit_levels_controller.rb +2 -2
  3. data/app/controllers/admin/cpd_audit_reviews_controller.rb +2 -2
  4. data/app/controllers/admin/cpd_audits_controller.rb +15 -1
  5. data/app/controllers/admin/cpd_statements_controller.rb +1 -1
  6. data/app/controllers/effective/cpd_audit_reviews_controller.rb +3 -39
  7. data/app/controllers/effective/cpd_audits_controller.rb +3 -41
  8. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +3 -1
  9. data/app/datatables/admin/effective_cpd_audits_datatable.rb +11 -9
  10. data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +4 -4
  11. data/app/datatables/effective_cpd_available_audits_datatable.rb +1 -1
  12. data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +3 -3
  13. data/app/datatables/effective_cpd_completed_audits_datatable.rb +2 -2
  14. data/app/helpers/effective_cpd_audits_helper.rb +0 -32
  15. data/app/mailers/effective/cpd_mailer.rb +37 -24
  16. data/app/models/concerns/effective_cpd_audit.rb +235 -66
  17. data/app/models/concerns/effective_cpd_audit_level.rb +7 -4
  18. data/app/models/concerns/effective_cpd_audit_review.rb +121 -65
  19. data/app/models/concerns/effective_cpd_user.rb +10 -5
  20. data/app/models/effective/cpd_audit_level_question.rb +1 -1
  21. data/app/models/effective/cpd_audit_level_section.rb +4 -3
  22. data/app/models/effective/cpd_audit_response.rb +3 -2
  23. data/app/models/effective/cpd_audit_review_item.rb +1 -1
  24. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +1 -1
  25. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +1 -1
  26. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +7 -1
  27. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +2 -0
  28. data/app/views/admin/cpd_audit_reviews/_form.html.haml +4 -1
  29. data/app/views/admin/cpd_audits/_form.html.haml +1 -49
  30. data/app/views/admin/cpd_audits/{_form_determination.html.haml → _form_close.html.haml} +1 -1
  31. data/app/views/admin/cpd_audits/_form_complete.html.haml +17 -0
  32. data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +56 -0
  33. data/app/views/admin/cpd_audits/_form_deadlines.html.haml +8 -9
  34. data/app/views/admin/cpd_audits/_form_exemption.html.haml +1 -1
  35. data/app/views/admin/cpd_audits/_form_extension.html.haml +1 -1
  36. data/app/views/admin/cpd_audits/_form_files.html.haml +6 -0
  37. data/app/views/admin/cpd_audits/_form_missing_info.html.haml +11 -0
  38. data/app/views/admin/cpd_audits/_form_new.html.haml +3 -1
  39. data/app/views/admin/cpd_audits/_form_process.html.haml +18 -0
  40. data/app/views/admin/cpd_audits/_status.html.haml +48 -6
  41. data/app/views/effective/cpd/_dashboard.html.haml +15 -12
  42. data/app/views/effective/cpd_audit_level_questions/_cpd_audit_level_question.html.haml +2 -1
  43. data/app/views/effective/cpd_audit_reviews/_conflict.html.haml +1 -1
  44. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +3 -3
  45. data/app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml +3 -1
  46. data/app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml +3 -3
  47. data/app/views/effective/cpd_audit_reviews/_feedback.html.haml +9 -0
  48. data/app/views/effective/cpd_audit_reviews/_files.html.haml +12 -0
  49. data/app/views/effective/cpd_audit_reviews/_layout.html.haml +3 -0
  50. data/app/views/effective/cpd_audit_reviews/_recommendation.html.haml +6 -2
  51. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +41 -14
  52. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +5 -1
  53. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +2 -2
  54. data/app/views/effective/cpd_audit_reviews/feedback.html.haml +16 -0
  55. data/app/views/effective/cpd_audit_reviews/files.html.haml +17 -0
  56. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +5 -3
  57. data/app/views/effective/cpd_audit_reviews/start.html.haml +10 -3
  58. data/app/views/effective/cpd_audit_reviews/statements.html.haml +4 -5
  59. data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
  60. data/app/views/effective/cpd_audit_reviews/submitted.html.haml +20 -0
  61. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +1 -1
  62. data/app/views/effective/cpd_audits/_conflict.html.haml +1 -1
  63. data/app/views/effective/cpd_audits/_cpd.html.haml +1 -1
  64. data/app/views/effective/cpd_audits/_cpd_audit.html.haml +3 -1
  65. data/app/views/effective/cpd_audits/_cpd_audit_level_section.html.haml +1 -1
  66. data/app/views/effective/cpd_audits/_exemption.html.haml +1 -1
  67. data/app/views/effective/cpd_audits/_extension.html.haml +1 -1
  68. data/app/views/effective/cpd_audits/_files.html.haml +1 -1
  69. data/app/views/effective/cpd_audits/_missing_info.html.haml +19 -0
  70. data/app/views/effective/cpd_audits/_summary.html.haml +30 -12
  71. data/app/views/effective/cpd_audits/_waiting.html.haml +1 -1
  72. data/app/views/effective/cpd_audits/conflict.html.haml +5 -1
  73. data/app/views/effective/cpd_audits/cpd_audit_level_section.html.haml +1 -0
  74. data/app/views/effective/cpd_audits/start.html.haml +10 -4
  75. data/app/views/effective/cpd_audits/submit.html.haml +5 -2
  76. data/app/views/effective/cpd_audits/{complete.html.haml → submitted.haml} +13 -8
  77. data/app/views/effective/cpd_audits/waiting.html.haml +1 -1
  78. data/app/views/effective/cpd_mailer/cpd_audit_missing_info.liquid +15 -0
  79. data/app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid +1 -1
  80. data/app/views/effective/cpd_mailer/cpd_audit_submitted.liquid +3 -1
  81. data/config/effective_cpd.rb +2 -2
  82. data/db/migrate/01_create_effective_cpd.rb.erb +25 -7
  83. data/lib/effective_cpd/version.rb +1 -1
  84. metadata +16 -5
  85. data/app/views/effective/cpd_audit_reviews/complete.html.haml +0 -20
@@ -1,9 +1,15 @@
1
1
  = render('layout') do
2
- %p You have been selected for #{resource.cpd_audit_level} audit and matched with:
2
+ %p You have been selected for #{resource.cpd_audit_level} audit.
3
3
 
4
- %ul
5
- - resource.cpd_audit_reviews.each do |cpd_audit_review|
6
- %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
4
+ - if resource.cpd_audit_level.anonymous?
5
+ %p This is an anonymous audit, and you have been assigned the name #{resource.name}
6
+
7
+ - if resource.cpd_audit_level.anonymous? == false
8
+ %p You have been matched with:
9
+
10
+ %ul
11
+ - resource.cpd_audit_reviews.each do |cpd_audit_review|
12
+ %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
7
13
 
8
14
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
9
15
  = f.hidden_field :current_step
@@ -7,9 +7,12 @@
7
7
  %strong will not
8
8
  be able to change your submission
9
9
 
10
- .mb-4= render(resource)
10
+ .mb-4= render('effective/cpd_audits/cpd_audit', cpd_audit: resource)
11
11
 
12
12
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
13
13
  = f.hidden_field :current_step
14
14
 
15
- = f.submit 'Submit Audit', center: true
15
+ - if EffectiveResources.authorized?(self, :resubmit, resource)
16
+ = f.submit 'Resubmit Audit', center: true
17
+ - else
18
+ = f.submit 'Submit Audit', center: true
@@ -2,12 +2,14 @@
2
2
  - raise('expected a submitted or conflicted cpd_audit') unless (resource.was_submitted? || resource.was_conflicted? || resource.closed?)
3
3
 
4
4
  - if resource.was_submitted?
5
- .text-center
6
- .row
7
- .col-2
8
- .col-8
9
- .alert.alert-success Audit Submitted!
5
+ .alert.alert-success.mb-4
6
+ This audit was submitted on #{resource.submitted_at.strftime('%F')}
10
7
 
8
+ - if resource.missing_info?
9
+ = card do
10
+ = render 'effective/cpd_audits/missing_info', cpd_audit: resource
11
+
12
+ - if resource.was_submitted?
11
13
  %p
12
14
  The following audit was successfully submitted at
13
15
  = succeed('.') do
@@ -19,7 +21,10 @@
19
21
  %strong= resource.user.email
20
22
  an email notifying you of the determination.
21
23
 
22
- .mb-4= render(resource)
24
+ = render 'effective/cpd_audits/summary', cpd_audit: resource
25
+
26
+ .mb-4
27
+ = collapse('Show audit...', card_class: 'my-2') do
28
+ = render 'effective/cpd_audits/cpd_audit', cpd_audit: resource
23
29
 
24
- %br
25
- .text-center= link_to 'Home', root_path, class: 'btn btn-primary'
30
+ = link_to "Return to Dashboard", return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
@@ -20,5 +20,5 @@
20
20
  = render("effective/cpd_audits/extension", cpd_audit: resource, step: :extension)
21
21
 
22
22
  %h2 Next Step
23
- %p= cpd_audit_summary_text(resource)
23
+ %p= resource.summary
24
24
  %p You may not continue at this time. Please wait for an email with further instructions. Thank you.
@@ -0,0 +1,15 @@
1
+ ---
2
+ subject: 'Your audit is missing information'
3
+ from: 'admin@example.com'
4
+ ---
5
+ Hello {{ auditee.name }},
6
+
7
+ Your audit is missing information:
8
+
9
+ {{ audit.missing_info_reason }}
10
+
11
+ Please update your audit with this info.
12
+
13
+ {{ url }}
14
+
15
+ Thank you
@@ -4,7 +4,7 @@ from: 'admin@example.com'
4
4
  ---
5
5
  Hello {{ reviewer.name }},
6
6
 
7
- The auditee {{ auditee.name }} has submitted their audit questionnaire.
7
+ The auditee {{ auditee.name }} has completed their audit questionnaire.
8
8
 
9
9
  It is now ready for you to review.
10
10
 
@@ -6,7 +6,9 @@ Hello Admin,
6
6
 
7
7
  The auditee {{ auditee.name }} has submitted their audit statement.
8
8
 
9
- The audit reviewers have been notified and may now begin their reviews.
9
+ Please review the audit and mark it complete or missing information.
10
+
11
+ Once marked complete, the audit reviewers will be notified and their review may begin.
10
12
 
11
13
  {{ url }}
12
14
 
@@ -45,10 +45,10 @@ EffectiveCpd.setup do |config|
45
45
  #
46
46
  # When creating a new audit, these are used to select the auditee
47
47
  # The User model must respond to these
48
- config.auditee_user_scope = :all
48
+ config.auditee_user_scope = :cpd_audit_auditees
49
49
 
50
50
  # Audit Reviewer Scope Collection
51
- config.audit_reviewer_user_scope = :all
51
+ config.audit_reviewer_user_scope = :cpd_audit_reviewers
52
52
 
53
53
  # Mailer Settings
54
54
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
@@ -120,7 +120,10 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
120
120
 
121
121
  create_table <%= @cpd_audit_levels_table_name %> do |t|
122
122
  t.string :title
123
+
123
124
  t.boolean :anonymous, default: false
125
+ t.string :anonymous_audits_prefix
126
+ t.string :anonymous_audit_reviews_prefix
124
127
 
125
128
  t.text :determinations
126
129
  t.text :recommendations
@@ -140,9 +143,11 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
140
143
  end
141
144
 
142
145
  create_table <%= @cpd_audit_level_sections_table_name %> do |t|
143
- t.references :cpd_audit_level
146
+ t.integer :cpd_audit_level_id
147
+ t.string :cpd_audit_level_type
144
148
 
145
149
  t.string :title
150
+ t.boolean :skip_review, default: false
146
151
  t.integer :position
147
152
 
148
153
  t.datetime :updated_at
@@ -150,7 +155,9 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
150
155
  end
151
156
 
152
157
  create_table <%= @cpd_audit_level_questions_table_name %> do |t|
153
- t.references :cpd_audit_level
158
+ t.integer :cpd_audit_level_id
159
+ t.string :cpd_audit_level_type
160
+
154
161
  t.references :cpd_audit_level_section
155
162
 
156
163
  t.text :title
@@ -174,7 +181,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
174
181
  end
175
182
 
176
183
  create_table <%= @cpd_audits_table_name %> do |t|
177
- t.intger :cpd_audit_level_id
184
+ t.integer :cpd_audit_level_id
178
185
  t.string :cpd_audit_level_type
179
186
 
180
187
  t.integer :user_id
@@ -183,10 +190,13 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
183
190
  t.date :due_date
184
191
 
185
192
  t.string :anonymous_name
186
- t.string :selection
187
- t.string :region
193
+ t.integer :anonymous_number
194
+
188
195
  t.text :notes
189
196
 
197
+ t.datetime :missing_info_at
198
+ t.text :missing_info_reason
199
+
190
200
  t.date :notification_date
191
201
  t.date :extension_date
192
202
 
@@ -206,6 +216,7 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
206
216
 
207
217
  t.datetime :started_at
208
218
  t.datetime :submitted_at
219
+ t.datetime :completed_at
209
220
  t.datetime :reviewed_at
210
221
  t.datetime :closed_at
211
222
 
@@ -232,7 +243,11 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
232
243
 
233
244
  t.date :due_date
234
245
 
246
+ t.string :anonymous_name
247
+ t.integer :anonymous_number
248
+
235
249
  t.text :comments
250
+ t.text :feedback
236
251
  t.string :recommendation
237
252
 
238
253
  t.boolean :conflict_of_interest
@@ -252,7 +267,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
252
267
  end
253
268
 
254
269
  create_table <%= @cpd_audit_review_items_table_name %> do |t|
255
- t.references :cpd_audit_review
270
+ t.integer :cpd_audit_review_id
271
+ t.string :cpd_audit_review_type
256
272
 
257
273
  t.integer :item_id
258
274
  t.string :item_type
@@ -265,7 +281,9 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
265
281
  end
266
282
 
267
283
  create_table <%= @cpd_audit_responses_table_name %> do |t|
268
- t.references :cpd_audit
284
+ t.integer :cpd_audit_id
285
+ t.string :cpd_audit_type
286
+
269
287
  t.references :cpd_audit_level_question
270
288
  t.references :cpd_audit_level_section
271
289
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  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.0.0
4
+ version: 1.1.0
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-12 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -251,12 +251,17 @@ files:
251
251
  - app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml
252
252
  - app/views/admin/cpd_audits/_auditee_fields.html.haml
253
253
  - app/views/admin/cpd_audits/_form.html.haml
254
+ - app/views/admin/cpd_audits/_form_close.html.haml
255
+ - app/views/admin/cpd_audits/_form_complete.html.haml
254
256
  - app/views/admin/cpd_audits/_form_conflict.html.haml
257
+ - app/views/admin/cpd_audits/_form_cpd_audit.html.haml
255
258
  - app/views/admin/cpd_audits/_form_deadlines.html.haml
256
- - app/views/admin/cpd_audits/_form_determination.html.haml
257
259
  - app/views/admin/cpd_audits/_form_exemption.html.haml
258
260
  - app/views/admin/cpd_audits/_form_extension.html.haml
261
+ - app/views/admin/cpd_audits/_form_files.html.haml
262
+ - app/views/admin/cpd_audits/_form_missing_info.html.haml
259
263
  - app/views/admin/cpd_audits/_form_new.html.haml
264
+ - app/views/admin/cpd_audits/_form_process.html.haml
260
265
  - app/views/admin/cpd_audits/_status.html.haml
261
266
  - app/views/admin/cpd_categories/_form.html.haml
262
267
  - app/views/admin/cpd_categories/_form_cpd_category.html.haml
@@ -304,13 +309,16 @@ files:
304
309
  - app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml
305
310
  - app/views/effective/cpd_audit_reviews/_cpd_audit_review.html.haml
306
311
  - app/views/effective/cpd_audit_reviews/_cpd_statement.html.haml
312
+ - app/views/effective/cpd_audit_reviews/_feedback.html.haml
313
+ - app/views/effective/cpd_audit_reviews/_files.html.haml
307
314
  - app/views/effective/cpd_audit_reviews/_layout.html.haml
308
315
  - app/views/effective/cpd_audit_reviews/_recommendation.html.haml
309
316
  - app/views/effective/cpd_audit_reviews/_summary.html.haml
310
- - app/views/effective/cpd_audit_reviews/complete.html.haml
311
317
  - app/views/effective/cpd_audit_reviews/conflict.html.haml
312
318
  - app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml
313
319
  - app/views/effective/cpd_audit_reviews/cpd_statement.html.haml
320
+ - app/views/effective/cpd_audit_reviews/feedback.html.haml
321
+ - app/views/effective/cpd_audit_reviews/files.html.haml
314
322
  - app/views/effective/cpd_audit_reviews/information.html.haml
315
323
  - app/views/effective/cpd_audit_reviews/instructions.html.haml
316
324
  - app/views/effective/cpd_audit_reviews/questionnaire.html.haml
@@ -318,6 +326,7 @@ files:
318
326
  - app/views/effective/cpd_audit_reviews/start.html.haml
319
327
  - app/views/effective/cpd_audit_reviews/statements.html.haml
320
328
  - app/views/effective/cpd_audit_reviews/submit.html.haml
329
+ - app/views/effective/cpd_audit_reviews/submitted.html.haml
321
330
  - app/views/effective/cpd_audit_reviews/waiting.html.haml
322
331
  - app/views/effective/cpd_audits/_conflict.html.haml
323
332
  - app/views/effective/cpd_audits/_cpd.html.haml
@@ -327,9 +336,9 @@ files:
327
336
  - app/views/effective/cpd_audits/_extension.html.haml
328
337
  - app/views/effective/cpd_audits/_files.html.haml
329
338
  - app/views/effective/cpd_audits/_layout.html.haml
339
+ - app/views/effective/cpd_audits/_missing_info.html.haml
330
340
  - app/views/effective/cpd_audits/_summary.html.haml
331
341
  - app/views/effective/cpd_audits/_waiting.html.haml
332
- - app/views/effective/cpd_audits/complete.html.haml
333
342
  - app/views/effective/cpd_audits/conflict.html.haml
334
343
  - app/views/effective/cpd_audits/cpd.html.haml
335
344
  - app/views/effective/cpd_audits/cpd_audit_level_section.html.haml
@@ -341,6 +350,7 @@ files:
341
350
  - app/views/effective/cpd_audits/questionnaire.html.haml
342
351
  - app/views/effective/cpd_audits/start.html.haml
343
352
  - app/views/effective/cpd_audits/submit.html.haml
353
+ - app/views/effective/cpd_audits/submitted.haml
344
354
  - app/views/effective/cpd_audits/waiting.html.haml
345
355
  - app/views/effective/cpd_mailer/README.md
346
356
  - app/views/effective/cpd_mailer/cpd_audit_closed.liquid
@@ -352,6 +362,7 @@ files:
352
362
  - app/views/effective/cpd_mailer/cpd_audit_extension_denied.liquid
353
363
  - app/views/effective/cpd_mailer/cpd_audit_extension_granted.liquid
354
364
  - app/views/effective/cpd_mailer/cpd_audit_extension_request.liquid
365
+ - app/views/effective/cpd_mailer/cpd_audit_missing_info.liquid
355
366
  - app/views/effective/cpd_mailer/cpd_audit_opened.liquid
356
367
  - app/views/effective/cpd_mailer/cpd_audit_review_opened.liquid
357
368
  - app/views/effective/cpd_mailer/cpd_audit_review_ready.liquid
@@ -1,20 +0,0 @@
1
- = render('layout') do
2
- - raise('expected a completed cpd_audit_review') unless resource.completed?
3
-
4
- .text-center
5
- .row
6
- .col-2
7
- .col-8
8
- .alert.alert-success Audit Review Submitted!
9
-
10
- %p
11
- The following audit review was successfully submitted at
12
- = succeed('.') do
13
- = resource.submitted_at.strftime('%F')
14
-
15
- %p Thank you for your review.
16
-
17
- .mb-4= render(resource)
18
-
19
- %br
20
- .text-center= link_to 'Home', root_path, class: 'btn btn-primary'