effective_cpd 0.3.0 → 0.3.3

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: 9940c548d939b8c1a285db0e19877bd4ed2147001fbebc947aaf6e02d548def6
4
- data.tar.gz: 0547a9982f49587cbe07f2d3b65b6ab0da31be1728d7a55541cebd48cb560dde
3
+ metadata.gz: e6bed34a47adc51ccbd8130374137416ce8c7eb58ad7d3594db16b4498ee889c
4
+ data.tar.gz: 8ef171411108e7e5d203c72733e12c597b99fed21ab7bb74f27097d6da4f797c
5
5
  SHA512:
6
- metadata.gz: bc621cc69009ae0a6629d11f07b8fcabcbf9aafe011649b441d096e90754938104b24c5633b0b7374f298b005d4e558a2f6ebcdca1c19b2b442883d4a7e3e018
7
- data.tar.gz: dca45ea584ab120514a7fb2d4231d2d19bcd373f84066e16ad57af2d05b46e605e7692d22e6e18c46913a3af233022dbac597672cacf337d7d350e80ae0b9030
6
+ metadata.gz: dda9b3ec1334ebe58aad35f13e47cca0a69c9711018046454a49aa0ae3d293b2813b871678681c360d2057923877103f2f9831ed02787e0dfadd66a93a435ae9
7
+ data.tar.gz: c7e0f49c69d1fc1c1513fc4bee4d5acd16ff4c28833c6d56179c805db928f5a0efe2bd4c35ee8af5f688c2a2a51745b62a2a967b5dbdab5bdb49a64a04257434
@@ -2,8 +2,8 @@ module Admin
2
2
  class EffectiveCpdAuditReviewsDatatable < Effective::Datatable
3
3
  filters do
4
4
  scope :all
5
- scope :available, label: 'In Progress'
6
5
  scope :completed
6
+ scope :available, label: 'In Progress'
7
7
  end
8
8
 
9
9
  datatable do
@@ -12,7 +12,14 @@ module Admin
12
12
  col :id, visible: false
13
13
 
14
14
  col :cpd_audit
15
+
16
+ col :auditee do |cpd_audit_review|
17
+ user = cpd_audit_review.cpd_audit.user
18
+ link_to(user, edit_admin_user_path(user))
19
+ end
20
+
15
21
  col :user, label: 'Audit Reviewer'
22
+
16
23
  col :due_date
17
24
  col :submitted_at, as: :date, label: 'Submitted'
18
25
  col :conflict_of_interest
@@ -47,6 +47,29 @@ module Admin
47
47
  col :due_date
48
48
 
49
49
  col :status
50
+
51
+ col(:cpd_audit_recommendations, label: 'Recommendation', visible: false) do |cpd_audit|
52
+ cpd_audit.cpd_audit_reviews.map(&:recommendation).map do |recommendation|
53
+ content_tag(:div, recommendation.to_s, class: 'col-resource_item')
54
+ end.join.html_safe
55
+ end
56
+
57
+ col(:cpd_audit_reveiw_item_recommendations, label: 'Item Recommendations', search: :string, visible: false) do |cpd_audit|
58
+ recommendations = cpd_audit.cpd_audit_reviews.map(&:recommendation)
59
+ item_recommendations = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:recommendation) }
60
+
61
+ reviews = ((recommendations + item_recommendations) - ['', nil]).uniq
62
+ reviews.to_sentence
63
+ end
64
+
65
+ col(:cpd_audit_comments, label: 'Reviewer Comments', search: :string, visible: false) do |cpd_audit|
66
+ item_comments = cpd_audit.cpd_audit_reviews.flat_map { |r| r.cpd_audit_review_items.map(&:comments) }.join
67
+
68
+ cpd_audit.cpd_audit_reviews.map(&:comments).map do |comments|
69
+ content_tag(:div, simple_format(comments.to_s + item_comments), class: 'col-resource_item')
70
+ end.join.html_safe
71
+ end
72
+
50
73
  col :determination
51
74
 
52
75
  col(:auditee_cpd_statements, label: 'Auditee Statements', visible: false) do |cpd_audit|
@@ -76,6 +76,9 @@ module Effective
76
76
  # Final determination
77
77
  determination :string
78
78
 
79
+ # Override Deadlines
80
+ ignore_deadlines :boolean
81
+
79
82
  # Auditee response
80
83
  conflict_of_interest :boolean
81
84
  conflict_of_interest_reason :text
@@ -130,17 +133,17 @@ module Effective
130
133
  validates :extension_request_date, presence: true, if: -> { extension_request? }
131
134
  validates :extension_request_reason, presence: true, if: -> { extension_request? }
132
135
 
133
- validate(if: -> { current_step == :conflict && conflict_of_interest? }) do
136
+ validate(if: -> { current_step == :conflict && conflict_of_interest? && !ignore_deadlines? }) do
134
137
  deadline = deadline_to_conflict_of_interest()
135
138
  self.errors.add(:base, 'deadline to declare conflict of interest has already passed') if deadline && deadline < Time.zone.now
136
139
  end
137
140
 
138
- validate(if: -> { current_step == :exemption && exemption_request? }) do
141
+ validate(if: -> { current_step == :exemption && exemption_request? && !ignore_deadlines? }) do
139
142
  deadline = deadline_to_exemption()
140
143
  self.errors.add(:base, 'deadline to request exemption has already passed') if deadline && deadline < Time.zone.now
141
144
  end
142
145
 
143
- validate(if: -> { current_step == :extension && extension_request? }) do
146
+ validate(if: -> { current_step == :extension && extension_request? && !ignore_deadlines? }) do
144
147
  deadline = deadline_to_extension()
145
148
  self.errors.add(:base, 'deadline to request extension has already passed') if deadline && deadline < Time.zone.now
146
149
  end
@@ -17,6 +17,9 @@
17
17
  = tab 'Audit' do
18
18
  = render 'effective/cpd_audits/cpd_audit', cpd_audit: cpd_audit
19
19
 
20
+ = tab 'Deadlines' do
21
+ = render 'admin/cpd_audits/form_deadlines', cpd_audit: cpd_audit
22
+
20
23
  = tab 'Statements' do
21
24
  - datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: cpd_audit.user.id, user_type: cpd_audit.user.class.name)
22
25
  = render_datatable(datatable, inline: true, simple: true)
@@ -0,0 +1,12 @@
1
+ = card('Deadlines') do
2
+ = effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
3
+ %p The audittee has the following deadlines:
4
+
5
+ %ul
6
+ %li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest}
7
+ %li To request exemption: #{f.object.deadline_to_exemption}
8
+ %li To request extension: #{f.object.deadline_to_extension}
9
+
10
+ = f.check_box :ignore_deadlines, label: 'Yes, ignore audittee deadlines and allow these actions to be performed'
11
+
12
+ = f.submit 'Save', center: true
@@ -1,22 +1,23 @@
1
1
  = render('layout') do
2
- - raise('expected a submitted cpd_audit') unless resource.was_submitted?
2
+ - raise('expected a submitted cpd_audit') unless resource.was_submitted? || resource.closed?
3
3
 
4
- .text-center
5
- .row
6
- .col-2
7
- .col-8
8
- .alert.alert-success Audit Submitted!
4
+ - if resource.was_submitted?
5
+ .text-center
6
+ .row
7
+ .col-2
8
+ .col-8
9
+ .alert.alert-success Audit Submitted!
9
10
 
10
- %p
11
- The following audit was successfully submitted at
12
- = succeed('.') do
13
- = resource.submitted_at.strftime('%F')
11
+ %p
12
+ The following audit was successfully submitted at
13
+ = succeed('.') do
14
+ = resource.submitted_at.strftime('%F')
14
15
 
15
- - unless resource.determination.present?
16
- Your audit must be reviewed and a final determination made.
17
- We will send
18
- %strong= resource.user.email
19
- an email notifying you of the determination.
16
+ - unless resource.determination.present?
17
+ Your audit must be reviewed and a final determination made.
18
+ We will send
19
+ %strong= resource.user.email
20
+ an email notifying you of the determination.
20
21
 
21
22
  .mb-4= render(resource)
22
23
 
@@ -5,7 +5,7 @@
5
5
  - resource.cpd_audit_reviews.each do |cpd_audit_review|
6
6
  %li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
7
7
 
8
- - if resource.deadline_to_conflict_of_interest.present?
8
+ - if resource.deadline_to_conflict_of_interest.present? && !resource.ignore_deadlines?
9
9
  %p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
10
10
 
11
11
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -2,7 +2,7 @@
2
2
  - if resource.was_exemption_requested?
3
3
  = render('effective/cpd_audits/exemption', cpd_audit: resource, step: :exemption)
4
4
 
5
- - if resource.deadline_to_exemption.present?
5
+ - if resource.deadline_to_exemption.present? && !resource.ignore_deadlines?
6
6
  %p The deadline to request an exemption is: #{resource.deadline_to_exemption.strftime('%F')}.
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -2,7 +2,7 @@
2
2
  - if resource.was_extension_requested?
3
3
  = render('effective/cpd_audits/extension', cpd_audit: resource, step: :extension)
4
4
 
5
- - if resource.deadline_to_extension.present?
5
+ - if resource.deadline_to_extension.present? && !resource.ignore_deadlines?
6
6
  %p The deadline to request an extension is: #{resource.deadline_to_extension.strftime('%F')}.
7
7
 
8
8
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
@@ -176,6 +176,8 @@ class CreateEffectiveCpd < ActiveRecord::Migration[6.0]
176
176
  t.date :notification_date
177
177
  t.date :extension_date
178
178
 
179
+ t.boolean :ignore_deadlines, default: false
180
+
179
181
  t.string :determination
180
182
 
181
183
  t.boolean :conflict_of_interest
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.3'
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: 0.3.0
4
+ version: 0.3.3
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: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2022-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -246,6 +246,7 @@ files:
246
246
  - app/views/admin/cpd_audits/_auditee_fields.html.haml
247
247
  - app/views/admin/cpd_audits/_form.html.haml
248
248
  - app/views/admin/cpd_audits/_form_conflict.html.haml
249
+ - app/views/admin/cpd_audits/_form_deadlines.html.haml
249
250
  - app/views/admin/cpd_audits/_form_determination.html.haml
250
251
  - app/views/admin/cpd_audits/_form_exemption.html.haml
251
252
  - app/views/admin/cpd_audits/_form_extension.html.haml