effective_cpd 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/controllers/admin/cpd_audits_controller.rb +4 -4
  4. data/app/controllers/admin/cpd_statement_activities_controller.rb +3 -5
  5. data/app/controllers/admin/cpd_statements_controller.rb +0 -2
  6. data/app/controllers/effective/cpd_audits_controller.rb +1 -1
  7. data/app/datatables/admin/effective_cpd_audit_reviews_datatable.rb +6 -6
  8. data/app/datatables/admin/effective_cpd_audits_datatable.rb +10 -10
  9. data/app/datatables/admin/effective_cpd_bulk_audits_datatable.rb +3 -4
  10. data/app/datatables/admin/effective_cpd_rules_datatable.rb +4 -4
  11. data/app/datatables/admin/effective_cpd_special_rules_datatable.rb +2 -2
  12. data/app/datatables/admin/effective_cpd_statement_activities_datatable.rb +3 -3
  13. data/app/datatables/admin/effective_cpd_statements_datatable.rb +1 -1
  14. data/app/datatables/effective_cpd_available_audit_reviews_datatable.rb +2 -2
  15. data/app/datatables/effective_cpd_available_audits_datatable.rb +1 -1
  16. data/app/datatables/effective_cpd_available_cycles_datatable.rb +1 -1
  17. data/app/datatables/effective_cpd_completed_audit_reviews_datatable.rb +3 -3
  18. data/app/datatables/effective_cpd_completed_audits_datatable.rb +2 -2
  19. data/app/datatables/effective_cpd_completed_statements_datatable.rb +3 -3
  20. data/app/helpers/effective_cpd_audits_helper.rb +1 -2
  21. data/app/helpers/effective_cpd_helper.rb +58 -6
  22. data/app/models/concerns/effective_cpd_audit.rb +27 -19
  23. data/app/models/concerns/effective_cpd_audit_level.rb +1 -1
  24. data/app/models/concerns/effective_cpd_audit_review.rb +1 -1
  25. data/app/models/concerns/effective_cpd_bulk_audit.rb +1 -1
  26. data/app/models/concerns/effective_cpd_statement.rb +1 -1
  27. data/app/models/effective/cpd_activity.rb +1 -1
  28. data/app/models/effective/cpd_audit_level_question.rb +1 -1
  29. data/app/models/effective/cpd_audit_level_question_option.rb +1 -1
  30. data/app/models/effective/cpd_audit_level_section.rb +1 -1
  31. data/app/models/effective/cpd_audit_response.rb +1 -1
  32. data/app/models/effective/cpd_audit_review_item.rb +1 -1
  33. data/app/models/effective/cpd_category.rb +1 -1
  34. data/app/models/effective/cpd_cycle.rb +1 -1
  35. data/app/models/effective/cpd_special_rule.rb +1 -1
  36. data/app/models/effective/cpd_statement_activity.rb +1 -1
  37. data/app/views/admin/cpd_activities/_form.html.haml +1 -1
  38. data/app/views/admin/cpd_audit_level_questions/_form.html.haml +1 -1
  39. data/app/views/admin/cpd_audit_levels/_form.html.haml +4 -4
  40. data/app/views/admin/cpd_audit_levels/_form_content_audit.html.haml +1 -1
  41. data/app/views/admin/cpd_audit_levels/_form_content_audit_review.html.haml +1 -1
  42. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level.html.haml +25 -18
  43. data/app/views/admin/cpd_audit_levels/_form_cpd_audit_level_section.html.haml +1 -1
  44. data/app/views/admin/cpd_audit_reviews/_form.html.haml +2 -2
  45. data/app/views/admin/cpd_audits/_audit_reviewer_fields.html.haml +1 -1
  46. data/app/views/admin/cpd_audits/_auditee_fields.html.haml +2 -2
  47. data/app/views/admin/cpd_audits/_form_chat.html.haml +2 -2
  48. data/app/views/admin/cpd_audits/_form_close.html.haml +2 -2
  49. data/app/views/admin/cpd_audits/_form_complete.html.haml +4 -4
  50. data/app/views/admin/cpd_audits/_form_conflict.html.haml +5 -5
  51. data/app/views/admin/cpd_audits/_form_cpd_audit.html.haml +6 -6
  52. data/app/views/admin/cpd_audits/_form_deadlines.html.haml +2 -2
  53. data/app/views/admin/cpd_audits/_form_exemption.html.haml +2 -2
  54. data/app/views/admin/cpd_audits/_form_extension.html.haml +2 -2
  55. data/app/views/admin/cpd_audits/_form_files.html.haml +1 -1
  56. data/app/views/admin/cpd_audits/_form_missing_info.html.haml +1 -1
  57. data/app/views/admin/cpd_audits/_form_new.html.haml +10 -12
  58. data/app/views/admin/cpd_audits/_form_process.html.haml +1 -1
  59. data/app/views/admin/cpd_audits/_status.html.haml +7 -10
  60. data/app/views/admin/cpd_bulk_audits/_form_cpd_bulk_audit.html.haml +6 -6
  61. data/app/views/admin/cpd_categories/_form.html.haml +2 -2
  62. data/app/views/admin/cpd_cycles/_form_cpd_cycle.html.haml +5 -5
  63. data/app/views/admin/cpd_special_rules/_form.html.haml +2 -2
  64. data/app/views/admin/cpd_statements/_cpd_statement.html.haml +2 -2
  65. data/app/views/admin/users/_form_cpd.html.haml +2 -2
  66. data/app/views/admin/users/_form_cpd_audits.html.haml +4 -4
  67. data/app/views/effective/cpd/_dashboard.html.haml +10 -10
  68. data/app/views/effective/cpd_audit_reviews/_cpd_audit_level_section.html.haml +1 -1
  69. data/app/views/effective/cpd_audit_reviews/_summary.html.haml +3 -3
  70. data/app/views/effective/cpd_audit_reviews/conflict.html.haml +1 -1
  71. data/app/views/effective/cpd_audit_reviews/cpd_audit_level_section.html.haml +1 -1
  72. data/app/views/effective/cpd_audit_reviews/cpd_statement.html.haml +1 -1
  73. data/app/views/effective/cpd_audit_reviews/feedback.html.haml +3 -3
  74. data/app/views/effective/cpd_audit_reviews/files.html.haml +2 -2
  75. data/app/views/effective/cpd_audit_reviews/instructions.html.haml +1 -1
  76. data/app/views/effective/cpd_audit_reviews/questionnaire.html.haml +1 -1
  77. data/app/views/effective/cpd_audit_reviews/recommendation.html.haml +3 -3
  78. data/app/views/effective/cpd_audit_reviews/start.html.haml +4 -4
  79. data/app/views/effective/cpd_audit_reviews/statements.html.haml +6 -6
  80. data/app/views/effective/cpd_audit_reviews/submit.html.haml +1 -1
  81. data/app/views/effective/cpd_audit_reviews/submitted.html.haml +3 -3
  82. data/app/views/effective/cpd_audit_reviews/waiting.html.haml +1 -1
  83. data/app/views/effective/cpd_audits/_missing_info.html.haml +3 -3
  84. data/app/views/effective/cpd_audits/_summary.html.haml +2 -2
  85. data/app/views/effective/cpd_audits/conflict.html.haml +2 -2
  86. data/app/views/effective/cpd_audits/start.html.haml +2 -2
  87. data/app/views/effective/cpd_audits/submit.html.haml +3 -3
  88. data/app/views/effective/cpd_audits/submitted.haml +4 -4
  89. data/app/views/effective/cpd_audits/waiting.html.haml +1 -1
  90. data/app/views/effective/cpd_statements/_activities_new.html.haml +1 -1
  91. data/app/views/effective/cpd_statements/_activities_table.html.haml +2 -2
  92. data/app/views/effective/cpd_statements/_summary.html.haml +1 -1
  93. data/app/views/effective/cpd_statements/agreements.html.haml +1 -1
  94. data/app/views/effective/cpd_statements/submit.html.haml +1 -1
  95. data/config/effective_cpd.rb +0 -5
  96. data/config/locales/effective_cpd.en.yml +28 -0
  97. data/config/routes.rb +1 -1
  98. data/lib/effective_cpd/version.rb +1 -1
  99. data/lib/effective_cpd.rb +1 -1
  100. data/lib/generators/effective_cpd/install_generator.rb +4 -0
  101. data/lib/tasks/effective_cpd_tasks.rake +23 -1
  102. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eed65d1a331a6a09e8f5435d1f200f646680773b271d0000358438c09122d29e
4
- data.tar.gz: 117455812ab24c1d74a19ba95ca4eccfebc3d2085094c394b272c47464ca9907
3
+ metadata.gz: 68280b10b19be0a77c79173eb4428f429b8905cfeb252ceac7e1d72279da36a0
4
+ data.tar.gz: ca76a95fadc2e71549f943069e8403d6d3f70c349f5c22847ee48396e371e48d
5
5
  SHA512:
6
- metadata.gz: fa0036e716e1c6b8871d4f149eb8e3f5c372d32888e8c4fd21c5bcda4763adb2eb069e4eaa77ff210172d4dcfff3c746fcc86c5e8720f83a133aa238a4481eb7
7
- data.tar.gz: baca0a12db533c7f1fc5dbb1ba9f1ae180b44aa18f30aa0bd360cff51898a4d1e24028f5f30a763e1cd01448bcabff2c3a5a533f6410dbfd0b6eece12ab32f40
6
+ metadata.gz: 4ca2c3fa8c4af2d901fedbcb5859dc2b09be5f99783cbaaf18d4bf2b858830116fe91e9caf51f741b4597283212685125237b6f10b62278d6103498908d3bb50
7
+ data.tar.gz: 21b70b0f7f7e22169059c0df7e3b8cd098e4ac117e7580c42329b2cd2c7c4b04c0c4c6dda76f0e9762a9510318e17f19671a94c1f87d6171f93799d7019af81b
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.
@@ -15,7 +15,7 @@ module Admin
15
15
  ].compact.join(' ')
16
16
  }
17
17
 
18
- submit :close, 'Close Audit', success: -> {
18
+ submit :close, 'Close', success: -> {
19
19
  [
20
20
  "Successfully closed #{resource}",
21
21
  ("and sent #{resource.user.email} a notification" unless resource.email_form_skip?)
@@ -36,17 +36,17 @@ module Admin
36
36
  ].compact.join(' ')
37
37
  }
38
38
 
39
- submit :complete, 'Complete Audit', success: -> {
39
+ submit :complete, 'Complete', success: -> {
40
40
  [
41
41
  "Successfully completed #{resource}",
42
- ("and sent reviewers an audit ready notification" unless resource.email_form_skip)
42
+ ("and sent notifications" unless resource.email_form_skip)
43
43
  ].compact.join(' ')
44
44
  }
45
45
 
46
46
  submit :complete, 'Ready to Review', success: -> {
47
47
  [
48
48
  "Successfully completed #{resource}",
49
- ("and sent reviewers an audit ready notification" unless resource.email_form_skip)
49
+ ("and sent notifications" unless resource.email_form_skip)
50
50
  ].compact.join(' ')
51
51
  }
52
52
 
@@ -5,11 +5,9 @@ module Admin
5
5
 
6
6
  include Effective::CrudController
7
7
 
8
- page_title(only: :index) { "#{EffectiveCpd.program_label} Statement Activities" }
9
-
10
- # def permitted_params
11
- # params.require(:effective_cpd_statement).permit!
12
- # end
8
+ def permitted_params
9
+ params.require(:effective_cpd_statement_activity).permit!
10
+ end
13
11
 
14
12
  end
15
13
  end
@@ -8,8 +8,6 @@ module Admin
8
8
  resource_scope -> { EffectiveCpd.CpdStatement.deep.all }
9
9
  datatable -> { EffectiveResources.best('Admin::EffectiveCpdStatementsDatatable').new }
10
10
 
11
- page_title(only: :index) { "#{EffectiveCpd.program_label} Statements" }
12
-
13
11
  private
14
12
 
15
13
  def permitted_params
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  resource_scope -> { EffectiveCpd.CpdAudit.deep.where(user: current_user) }
8
8
 
9
- submit :resubmit, 'Resubmit Audit'
9
+ submit :resubmit, 'Resubmit'
10
10
 
11
11
  page_title 'Chat', only: [:chat]
12
12
 
@@ -2,8 +2,8 @@ module Admin
2
2
  class EffectiveCpdAuditReviewsDatatable < Effective::Datatable
3
3
  filters do
4
4
  scope :all
5
- scope :completed
6
5
  scope :available, label: 'In Progress'
6
+ scope :completed
7
7
  end
8
8
 
9
9
  datatable do
@@ -11,22 +11,22 @@ module Admin
11
11
  col :updated_at, visible: false
12
12
  col :id, visible: false
13
13
 
14
- col :cpd_audit
15
- col :cpd_audit_level, search: EffectiveCpd.CpdAuditLevel.all.sorted
14
+ col :cpd_audit, label: cpd_audit_label
15
+ col :cpd_audit_level, label: cpd_audit_level_label, search: EffectiveCpd.CpdAuditLevel.all.sorted
16
16
 
17
- col :auditee do |cpd_audit_review|
17
+ col :auditee, label: cpd_auditee_label do |cpd_audit_review|
18
18
  user = cpd_audit_review.cpd_audit.user
19
19
  url = "/admin/users/#{user.to_param}/edit"
20
20
  link_to(user, url)
21
21
  end
22
22
 
23
- col :user, label: 'Audit Reviewer'
23
+ col :user, label: cpd_reviewer_label
24
24
 
25
25
  col :due_date
26
26
  col :submitted_at, as: :date, label: 'Submitted'
27
27
  col :conflict_of_interest
28
28
  col :recommendation
29
- col :comments, label: 'Reviewer notes'
29
+ col :comments
30
30
 
31
31
  actions_col(edit: false)
32
32
  end
@@ -6,8 +6,8 @@ module Admin
6
6
  scope :available, label: 'In Progress'
7
7
  scope :done
8
8
  scope :waiting_on_admin
9
- scope :waiting_on_auditee
10
- scope :waiting_on_reviewers
9
+ scope :waiting_on_auditee, label: "Waiting on #{cpd_auditee_label}"
10
+ scope :waiting_on_reviewers, label: "Waiting on #{cpd_reviewers_label}"
11
11
  end
12
12
 
13
13
  datatable do
@@ -19,11 +19,11 @@ module Admin
19
19
 
20
20
  col :token, visible: false
21
21
 
22
- col :cpd_audit_level, label: 'Audit Level', search: EffectiveCpd.CpdAuditLevel.sorted.all
22
+ col :cpd_audit_level, label: cpd_audit_level_label, search: EffectiveCpd.CpdAuditLevel.sorted.all
23
23
 
24
- col :user, search: :string, label: 'Auditee'
24
+ col :user, search: :string
25
25
 
26
- col(:cpd_audit_reviews, label: 'Auditor Reviewers', search: :string) do |cpd_audit|
26
+ col(:cpd_audit_reviews, search: :string) do |cpd_audit|
27
27
  cpd_audit.cpd_audit_reviews.map(&:user).map do |user|
28
28
  content_tag(:div, class: 'col-resource_item') do
29
29
  url = view.respond_to?(:edit_admin_user_path) ? edit_admin_user_path(user) : "/admin/users/#{user.to_param}/edit"
@@ -42,8 +42,8 @@ module Admin
42
42
  end
43
43
  end
44
44
 
45
- col :notification_date, label: 'Date of Notification'
46
- col :extension_date, label: 'Approved Extension Date', visible: false
45
+ col :notification_date
46
+ col :extension_date, visible: false
47
47
  col :due_date
48
48
 
49
49
  col :status
@@ -54,7 +54,7 @@ module Admin
54
54
  end.join.html_safe
55
55
  end
56
56
 
57
- col(:cpd_audit_reveiw_item_recommendations, label: 'Item Recommendations', search: :string, visible: false) do |cpd_audit|
57
+ col(:cpd_audit_review_item_recommendations, label: 'Item Recommendations', search: :string, visible: false) do |cpd_audit|
58
58
  recommendations = cpd_audit.cpd_audit_reviews.map(&:recommendation)
59
59
  item_recommendations = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:recommendation) }
60
60
 
@@ -62,7 +62,7 @@ module Admin
62
62
  reviews.to_sentence
63
63
  end
64
64
 
65
- col(:cpd_audit_comments, label: 'Reviewer Comments', search: :string, visible: false) do |cpd_audit|
65
+ col(:cpd_audit_comments, search: :string, visible: false) do |cpd_audit|
66
66
  item_comments = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:comments) }.join
67
67
 
68
68
  cpd_audit.cpd_audit_reviews.map(&:comments).map do |comments|
@@ -72,7 +72,7 @@ module Admin
72
72
 
73
73
  col :determination
74
74
 
75
- col(:auditee_cpd_statements, label: 'Auditee Statements', visible: false) do |cpd_audit|
75
+ col(:auditee_cpd_statements, visible: false) do |cpd_audit|
76
76
  cpd_audit.user.cpd_statements.map do |cpd_statement|
77
77
  content_tag(:div, class: 'col-resource_item') do
78
78
  link_to(cpd_statement.to_s, effective_cpd.admin_cpd_statement_path(cpd_statement))
@@ -8,11 +8,10 @@ module Admin
8
8
  col :updated_at, label: 'Updated', visible: false
9
9
  col :created_at, label: 'Created'
10
10
 
11
- col :cpd_audit_level
12
- col :audits
13
- col :audit_reviewers_per_audit
11
+ col :cpd_audit_level, label: cpd_audit_level_label
12
+ col :audits, label: cpd_audits_label
13
+ col :audit_reviewers_per_audit, label: "#{cpd_reviewers_label} per #{cpd_audit_label}"
14
14
  col :notification_date
15
- col :email_form_skip
16
15
 
17
16
  actions_col
18
17
  end
@@ -12,7 +12,7 @@ module Admin
12
12
  col :created_at, visible: false
13
13
  col :updated_at, visible: false
14
14
 
15
- col :cpd_cycle,label: cpd_cycle_label.titleize
15
+ col :cpd_cycle
16
16
 
17
17
  col :ruleable, label: 'Category or Activity', search: {
18
18
  collection: {
@@ -26,10 +26,10 @@ module Admin
26
26
  content_tag(:div, cpd_activity.formula, style: 'white-space: nowrap;')
27
27
  end
28
28
 
29
- col :credit_description
29
+ col :credit_description, label: "#{cpd_credit_label} Description"
30
30
 
31
- col :max_credits_per_cycle, label: 'Max ' + cpd_credits_label.titleize
32
- col :max_cycles_can_carry_forward, label: 'Max ' + cpd_cycles_label.titleize
31
+ col :max_credits_per_cycle, label: 'Max ' + cpd_credits_label
32
+ col :max_cycles_can_carry_forward, label: 'Max ' + cpd_cycles_label
33
33
 
34
34
  col :unavailable
35
35
 
@@ -5,12 +5,12 @@ module Admin
5
5
  col :created_at, visible: false
6
6
  col :updated_at, visible: false
7
7
 
8
- col :cpd_cycle, label: cpd_cycle_label.titleize
8
+ col :cpd_cycle
9
9
 
10
10
  col :cpd_rules
11
11
 
12
12
  col :category
13
- col :max_credits_per_cycle, label: 'Max ' + cpd_credits_label.titleize
13
+ col :max_credits_per_cycle, label: 'Max ' + cpd_credits_label
14
14
 
15
15
  actions_col
16
16
  end
@@ -13,15 +13,15 @@ module Admin
13
13
  col :created_at, visible: false
14
14
  col :updated_at, visible: false
15
15
 
16
- col :cpd_cycle, label: cpd_cycle_label.capitalize, search: Effective::CpdCycle.sorted
17
- col :cpd_statement, visible: false
16
+ col :cpd_cycle, search: Effective::CpdCycle.sorted
17
+ col :cpd_statement, label: cpd_statement_label, visible: false
18
18
 
19
19
  col :user
20
20
 
21
21
  col :date
22
22
  col :description
23
23
 
24
- col :score, label: cpd_credits_label.capitalize do |csa|
24
+ col :score, label: cpd_credits_label do |csa|
25
25
  cpd_score(csa.score)
26
26
  end
27
27
 
@@ -14,7 +14,7 @@ module Admin
14
14
  col :created_at, visible: false
15
15
  col :updated_at, visible: false
16
16
 
17
- col :cpd_cycle, label: cpd_cycle_label.capitalize, search: Effective::CpdCycle.sorted
17
+ col :cpd_cycle, search: Effective::CpdCycle.sorted
18
18
  col :user
19
19
  col :submitted_at, as: :date, label: 'Submitted on'
20
20
 
@@ -6,9 +6,9 @@ class EffectiveCpdAvailableAuditReviewsDatatable < Effective::Datatable
6
6
 
7
7
  col :token, visible: false
8
8
 
9
- col :cpd_audit_level, label: 'Audit'
9
+ col :cpd_audit_level, label: cpd_audit_level_label
10
10
  col :due_date
11
- col :name, label: 'Auditee', action: false
11
+ col :name, label: cpd_auditee_label, action: false
12
12
 
13
13
  col :ready_to_review do |cpd_audit|
14
14
  cpd_audit.ready_to_review? ? 'Yes' : 'No'
@@ -6,7 +6,7 @@ class EffectiveCpdAvailableAuditsDatatable < Effective::Datatable
6
6
 
7
7
  col :token, visible: false
8
8
 
9
- col :cpd_audit_level, label: 'Audit'
9
+ col :cpd_audit_level, label: cpd_audit_level_label
10
10
  col :due_date
11
11
  col :status
12
12
  col :determination
@@ -6,7 +6,7 @@ class EffectiveCpdAvailableCyclesDatatable < Effective::Datatable
6
6
 
7
7
  col :start_at, visible: false
8
8
 
9
- col(:title, label: cpd_cycle_label.titleize)
9
+ col(:title, label: cpd_cycle_label)
10
10
  col :available_date, label: 'Available'
11
11
 
12
12
  col :required_score, label: 'Required' do |cpd_cycle|
@@ -6,9 +6,9 @@ class EffectiveCpdCompletedAuditReviewsDatatable < Effective::Datatable
6
6
 
7
7
  col :token, visible: false
8
8
 
9
- col :cpd_audit_level, label: 'Audit'
10
- col :notification_date, label: 'Date of Notification'
11
- col :name, label: 'Auditee', action: false
9
+ col :cpd_audit_level, label: cpd_audit_level_label
10
+ col :notification_date
11
+ col :name, label: cpd_auditee_label, action: false
12
12
 
13
13
  col :recommendation do |cpd_audit|
14
14
  cpd_audit.cpd_audit_reviews.find { |r| r.user_id == current_user.id }.recommendation
@@ -6,8 +6,8 @@ class EffectiveCpdCompletedAuditsDatatable < Effective::Datatable
6
6
 
7
7
  col :token, visible: false
8
8
 
9
- col :cpd_audit_level, label: 'Audit'
10
- col :notification_date, label: 'Date of Notification'
9
+ col :cpd_audit_level, label: cpd_audit_level_label
10
+ col :notification_date
11
11
  col :status
12
12
  col :determination
13
13
 
@@ -4,12 +4,12 @@ class EffectiveCpdCompletedStatementsDatatable < Effective::Datatable
4
4
  datatable do
5
5
  order :cpd_cycle_id
6
6
 
7
- col(:cpd_cycle_id, label: 'Statement') do |statement|
7
+ col(:cpd_cycle_id, label: cpd_statement_label) do |statement|
8
8
  statement.cpd_cycle.to_s
9
9
  end
10
10
 
11
- col :submitted_at, as: :date, label: 'Submitted'
12
- col :score, label: cpd_credits_label.capitalize
11
+ col :submitted_at
12
+ col :score, label: cpd_credits_label
13
13
 
14
14
  col :required_score, label: 'Required' do |cpd_statement|
15
15
  cpd_score(cpd_statement.required_score || cpd_statement.targeted_score)
@@ -21,8 +21,7 @@ module EffectiveCpdAuditsHelper
21
21
 
22
22
  users.map do |user|
23
23
  in_progress = content_tag(:span, class: 'badge badge-info') do
24
- reviews = user.cpd_audit_reviews.count { |review| review.in_progress? }
25
- "#{pluralize(reviews, 'review')} in progress"
24
+ user.cpd_audit_reviews.count { |review| review.in_progress? }.to_s + ' in progress'
26
25
  end
27
26
 
28
27
  html = content_tag(:div, "#{user} #{in_progress}")
@@ -1,19 +1,71 @@
1
1
  module EffectiveCpdHelper
2
2
 
3
+ def cpd_name_label
4
+ et('effective_cpd.name')
5
+ end
6
+
7
+ def cpd_credit_label
8
+ et('effective_cpd.credit')
9
+ end
10
+
11
+ def cpd_credits_label
12
+ ets('effective_cpd.credit')
13
+ end
14
+
3
15
  def cpd_cycle_label
4
- (EffectiveCpd.cycle_label || '').to_s.html_safe
16
+ et(Effective::CpdCycle)
5
17
  end
6
18
 
7
19
  def cpd_cycles_label
8
- (EffectiveCpd.cycle_label || '').to_s.pluralize.html_safe
20
+ ets(Effective::CpdCycle)
9
21
  end
10
22
 
11
- def cpd_credit_label
12
- (EffectiveCpd.credit_label || '').to_s.html_safe
23
+ def cpd_statement_label
24
+ et(EffectiveCpd.CpdStatement)
13
25
  end
14
26
 
15
- def cpd_credits_label
16
- (EffectiveCpd.credit_label || '').to_s.pluralize.html_safe
27
+ def cpd_statements_label
28
+ ets(EffectiveCpd.CpdStatement)
29
+ end
30
+
31
+ def cpd_audit_label
32
+ et(EffectiveCpd.CpdAudit)
33
+ end
34
+
35
+ def cpd_audits_label
36
+ ets(EffectiveCpd.CpdAudit)
37
+ end
38
+
39
+ def cpd_audit_review_label
40
+ et(EffectiveCpd.CpdAuditReview)
41
+ end
42
+
43
+ def cpd_audit_reviews_label
44
+ ets(EffectiveCpd.CpdAuditReview)
45
+ end
46
+
47
+ def cpd_auditee_label
48
+ et(EffectiveCpd.CpdAudit, :user)
49
+ end
50
+
51
+ def cpd_auditees_label
52
+ ets(EffectiveCpd.CpdAudit, :user)
53
+ end
54
+
55
+ def cpd_reviewer_label
56
+ et(EffectiveCpd.CpdAuditReview, :user)
57
+ end
58
+
59
+ def cpd_reviewers_label
60
+ ets(EffectiveCpd.CpdAuditReview, :user)
61
+ end
62
+
63
+ def cpd_audit_level_label
64
+ et(EffectiveCpd.CpdAuditLevel)
65
+ end
66
+
67
+ def cpd_audit_levels_label
68
+ ets(EffectiveCpd.CpdAuditLevel)
17
69
  end
18
70
 
19
71
  def cpd_rule_formula_hint(cpd_activity)
@@ -226,7 +226,7 @@ module EffectiveCpdAudit
226
226
 
227
227
  validate(if: -> { determination.present? }) do
228
228
  unless cpd_audit_level.determinations.include?(determination)
229
- self.errors.add(:determination, 'must exist in this audit level')
229
+ self.errors.add(:determination, 'is not included')
230
230
  end
231
231
  end
232
232
 
@@ -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|
@@ -314,7 +312,7 @@ module EffectiveCpdAudit
314
312
  end
315
313
 
316
314
  def to_s
317
- (cpd_audit_level.present? && name.present?) ? "#{cpd_audit_level} Audit of #{name}" : 'audit'
315
+ (cpd_audit_level.present? && name.present?) ? "#{cpd_audit_level} #{model_name.human} of #{name}" : model_name.human
318
316
  end
319
317
 
320
318
  def name
@@ -362,41 +360,46 @@ module EffectiveCpdAudit
362
360
  end
363
361
 
364
362
  def summary
363
+ audit = model_name.human
364
+ auditee = EffectiveCpd.CpdAudit.human_attribute_name(:user)
365
+ reviewer = EffectiveCpd.CpdAuditReview.human_attribute_name(:user)
366
+ reviewers = EffectiveCpd.CpdAuditReview.human_attribute_name(:user).pluralize
367
+
365
368
  case status_was
366
369
  when 'opened'
367
- "The audit has been opened. The auditee and audit reviewers have been notified. Waiting for the auditee to submit their audit questionnaire."
370
+ "The #{audit} has been opened. The #{auditee} and #{reviewers} have been notified. Waiting for the #{auditee} to submit."
368
371
  when 'started'
369
- "The auditee has begun their audit questionnaire. Waiting for the auditee to submit their audit questionnaire."
372
+ "The #{auditee} has started their #{audit}. Waiting for the #{auditee} to submit."
370
373
  when 'conflicted'
371
- "The auditee has declared a conflict of interest. A new reviewer will be assigned."
374
+ "The #{auditee} has declared a conflict of interest. A new #{reviewer} will be assigned."
372
375
  when 'conflicted_resolved'
373
- "The auditee had declared a conflict of interest. This has been resolved. Waiting for the auditee to submit their audit questionnaire."
376
+ "The #{auditee} had declared a conflict of interest. This has been resolved. Waiting for the #{auditee} to submit."
374
377
  when 'exemption_requested'
375
- "The auditee has requested an exemption. Waiting for request to be granted or denied."
378
+ "The #{auditee} has requested an exemption. Waiting for request to be granted or denied."
376
379
  when 'exemption_granted'
377
- "The exemption request has been granted. This audit may now be closed."
380
+ "The exemption request has been granted. This #{audit} may now be closed."
378
381
  when 'exemption_denied'
379
- "The exemption request has been denied. The audit will continue. Waiting for the auditee to submit their audit questionnaire."
382
+ "The exemption request has been denied. The #{audit} will continue. Waiting for the #{auditee} to submit."
380
383
  when 'extension_requested'
381
- "The auditee has requested an extension. Waiting for request to be granted or denied."
384
+ "The #{auditee} has requested an extension. Waiting for request to be granted or denied."
382
385
  when 'extension_granted'
383
- "The extension request has been granted. There is a new deadline. Waiting for the auditee to submit their audit questionnaire."
386
+ "The extension request has been granted. There is a new deadline. Waiting for the #{auditee} to submit."
384
387
  when 'extension_denied'
385
- "The extension request has been denied. The deadline remains. Waiting for the auditee to submit their audit questionnaire."
388
+ "The extension request has been denied. The deadline remains. Waiting for the #{auditee} to submit."
386
389
  when 'submitted'
387
- summary = "Auditee has submitted their audit wizard."
390
+ summary = "#{auditee} has submitted their #{audit} wizard."
388
391
  tasks = "The following tasks remain before it can be completed:"
389
392
  approval = "Waiting on completeness check, review and determination."
390
393
  items = completed_requirements.map { |item, done| "<li>#{item}: #{done ? 'Complete' : 'Incomplete'}</li>" }.join
391
394
  completed_requirements.present? ? "<p>#{summary} #{tasks}</p><ul>#{items}</ul>" : "#{summary} #{approval}"
392
395
  when 'completed'
393
- "All required materials have been provided. Ready to review. This audit will transition to 'reviewed' after all reviewers have finished."
396
+ "All required materials have been provided. Ready to review. This #{audit} will transition to 'reviewed' after all #{reviewers} have submitted."
394
397
  when 'missing_info'
395
398
  "Missing the following information: <ul><li>#{missing_info_reason}</li></ul>"
396
399
  when 'reviewed'
397
- "The audit has been reviewed and is ready for the final determination to be made."
400
+ "The #{audit} has been reviewed and is ready for the final determination to be made."
398
401
  when 'closed'
399
- "This audit has been closed with a final determination #{determination}. All done."
402
+ "This #{audit} has been closed with a final determination #{determination}. All done."
400
403
  else
401
404
  raise("unexpected status #{status}")
402
405
  end.html_safe
@@ -413,6 +416,11 @@ module EffectiveCpdAudit
413
416
  cpd_audit_response ||= cpd_audit_responses.build(cpd_audit: self, cpd_audit_level_question: cpd_audit_level_question)
414
417
  end
415
418
 
419
+ def notify!
420
+ send_email(:cpd_audit_opened)
421
+ true
422
+ end
423
+
416
424
  # Auditee wizard action
417
425
  def start!
418
426
  started!
@@ -100,7 +100,7 @@ module EffectiveCpdAuditLevel
100
100
  end
101
101
 
102
102
  def to_s
103
- title.presence || 'audit level'
103
+ title.presence || model_name.human
104
104
  end
105
105
 
106
106
  def determinations
@@ -178,7 +178,7 @@ module EffectiveCpdAuditReview
178
178
  end
179
179
 
180
180
  def to_s
181
- persisted? ? "#{cpd_audit_level} Audit Review by #{name}" : 'audit review'
181
+ persisted? ? "#{cpd_audit_level} #{model_name.human} by #{name}" : model_name.human
182
182
  end
183
183
 
184
184
  def name
@@ -80,7 +80,7 @@ module EffectiveCpdBulkAudit
80
80
  end
81
81
 
82
82
  def to_s
83
- 'bulk audit'
83
+ model_name.human
84
84
  end
85
85
 
86
86
  def cpd_user_scope
@@ -96,7 +96,7 @@ module EffectiveCpdStatement
96
96
  end
97
97
 
98
98
  def to_s
99
- cpd_cycle.present? ? "#{cpd_cycle} Statement" : 'statement'
99
+ cpd_cycle.present? ? "#{cpd_cycle} #{model_name.human}" : model_name.human
100
100
  end
101
101
 
102
102
  def import!(date: nil)
@@ -44,7 +44,7 @@ module Effective
44
44
  end
45
45
 
46
46
  def to_s
47
- title.presence || 'activity'
47
+ title.presence || model_name.human
48
48
  end
49
49
 
50
50
  def amount_static?
@@ -84,7 +84,7 @@ module Effective
84
84
  end
85
85
 
86
86
  def to_s
87
- title.presence || 'audit question'
87
+ title.presence || model_name.human
88
88
  end
89
89
 
90
90
  end
@@ -27,7 +27,7 @@ module Effective
27
27
  end
28
28
 
29
29
  def to_s
30
- title.presence || 'New Audit Question Option'
30
+ title.presence || model_name.human
31
31
  end
32
32
 
33
33
  end
@@ -44,7 +44,7 @@ module Effective
44
44
  end
45
45
 
46
46
  def to_s
47
- title.presence || 'audit section'
47
+ title.presence || "New Section" # Don't humanize this one
48
48
  end
49
49
 
50
50
  end
@@ -60,7 +60,7 @@ module Effective
60
60
  length: { maximum: 5, message: 'please select 5 options or fewer' }
61
61
 
62
62
  def to_s
63
- 'audit response'
63
+ model_name.human
64
64
  end
65
65
 
66
66
  def response
@@ -27,7 +27,7 @@ module Effective
27
27
  end
28
28
 
29
29
  def to_s
30
- recommendation.presence || 'cpd audit review item'
30
+ recommendation.presence || model_name.human
31
31
  end
32
32
 
33
33
  end