Skip to content

Commit

Permalink
CRM457-1987: QA feedback (#804)
Browse files Browse the repository at this point in the history
## Description of change
- Update order of provider updates
- Add new confirmation screen after sending back
- Tweak event history
- Tweak overview UI

[Link to relevant
ticket](https://dsdmoj.atlassian.net/browse/CRM457-1987)
  • Loading branch information
patrick-laa authored Oct 14, 2024
1 parent dd03680 commit a56cbb8
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/controllers/nsm/claim_details_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def show
def provider_updates
return nil if claim.data['further_information'].blank?

BaseViewModel.build(:further_information, claim, 'further_information').sort_by(&:requested_at)
BaseViewModel.build(:further_information, claim, 'further_information').sort_by(&:requested_at).reverse
end

def claim
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/nsm/send_backs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ module Nsm
class SendBacksController < Nsm::BaseController
include NameConstructable

def show
claim
end

def edit
send_back = SendBackForm.new(claim: claim, send_back_comment: claim.data['send_back_comment'])
render locals: { claim:, send_back: }
Expand All @@ -14,7 +18,7 @@ def update
send_back.stash
redirect_to your_nsm_claims_path
elsif send_back.save
redirect_to your_nsm_claims_path
redirect_to nsm_claim_send_back_path(claim)
else
render :edit, locals: { claim:, send_back: }
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/event/new_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ def self.build(submission:)
create(submission: submission, submission_version: submission.current_version)
.tap(&:notify)
end

def body
t('updated_body') if submission_version > 1
end
end
end
4 changes: 4 additions & 0 deletions app/models/nsm/event/send_back.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ class SendBack < ::Event::Decision
def title
t('title')
end

def body
t('body')
end
end
end
end
3 changes: 2 additions & 1 deletion app/views/nsm/claim_details/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<% if claim.sent_back? || claim.expired? %>
<div class="govuk-inset-text">
<p><strong><%= t(".sent_back", date: claim_summary.sent_back_on.to_fs(:stamp)) %></strong></p>
<%= t(".further_information_request") %>
<%= simple_format claim_summary.assessment_comment %>
</div>
<% elsif claim.provider_updated? %>
Expand Down Expand Up @@ -40,7 +41,7 @@
<% if provider_updates %>
<h2 class="govuk-heading-m" id="further-info"><%= t('.provider_updates') %> </h2>
<% provider_updates.each do |further_information| %>
<%= govuk_summary_list(card: { title: further_information.title }) do |table|
<%= govuk_summary_list(card: { title: further_information.title }, actions: false) do |table|
further_information.data.each do | field |
table.with_row do |row|
row.with_key(text: field[:title])
Expand Down
35 changes: 35 additions & 0 deletions app/views/nsm/send_backs/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<% title t('.page_title') %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">
<%= t('.page_title') %>
</h1>
</div>
<p><%= t('.sent_to_provider') %></p>
<dl class="govuk-summary-list">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
<%= t('.laa_reference') %>
</dt>
<dd class="govuk-summary-list__value">
<%= @claim.data['laa_reference'] %>
</dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
<%= t('.further_information') %>
</dt>
<dd class="govuk-summary-list__value">
<%= simple_format @claim.data['assessment_comment'] %>
</dd>
</div>
</dl>
<div class="govuk-button-group govuk-button-group-vertically-centred">
<%= govuk_button_to(t('.next_claim'), nsm_claims_path) %>
<%= govuk_link_to(t('.return'), nsm_claim_claim_details_path(@claim)) %>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion config/locales/en/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ en:
rejected: Decision made to reject claim
event/new_version:
title: Received
updated_body: Received from Provider with further information
event/note:
title: Caseworker note
nsm/event/send_back:
title: Claim sent back to provider
title: Sent back
body: Sent back to Provider for further information
event/unassignment:
title:
self: Caseworker removed self from claim
Expand Down
3 changes: 2 additions & 1 deletion config/locales/en/nsm/claim_details.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ en:
page_title: Assess a non-standard magistrates’ court payment
overview: Overview
sent_back: Sent back to provider on %{date}
further_information_request: 'Further information request:'
assessed_statuses:
granted: Granted
part_grant: Part granted
Expand Down Expand Up @@ -95,7 +96,7 @@ en:
identification: Defendant identification
disability: Defendant disability
provider_update:
title: Further information request
title: Further information request %{date}
caseworker: Caseworker
information_request: Information request
provider_response: Provider response
7 changes: 7 additions & 0 deletions config/locales/en/nsm/send_back.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ en:
save_and_exit: Save and come back later
update:
decision: You sent back this claim <a class="govuk-link" href="%{url}">%{ref}</a>
show:
page_title: Claim sent back
sent_to_provider: Your request has been sent to the provider.
laa_reference: Claim reference
further_information: Further information request
next_claim: Assess next claim
return: Return to the claim

helpers:
label:
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
resource :history, only: [:show, :create]
resource :change_risk, only: [:edit, :update], path_names: { edit: '' }
resource :make_decision, only: [:edit, :update], path_names: { edit: '' }
resource :send_back, only: [:edit, :update], path_names: { edit: '' }
resource :send_back, only: [:edit, :update, :show]
resource :unassignment, only: [:edit, :update], path_names: { edit: '' }
resources :assignments, only: %i[new create]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/nsm/claim_details_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
let(:further_information) { [instance_double(Nsm::V1::FurtherInformation)] }

before do
allow(further_information).to receive(:sort_by).and_return true
allow(further_information).to receive(:sort_by).and_return further_information
allow(BaseViewModel).to receive(:build)
.with(:further_information, claim, 'further_information')
.and_return(further_information)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/nsm/send_backs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
nsm_send_back_form: { send_back_comment: nil, id: claim.id }
}

expect(response).to redirect_to(your_nsm_claims_path)
expect(response).to redirect_to(nsm_claim_send_back_path(claim))
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/models/event/send_back_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
end

it 'has a valid title' do
expect(subject.title).to eq('Claim sent back to provider')
expect(subject.title).to eq('Sent back')
end

it 'body is set to comment' do
expect(subject.body).to eq('decison was made')
it 'body is set to static text' do
expect(subject.body).to eq('Sent back to Provider for further information')
end
end
2 changes: 1 addition & 1 deletion spec/system/nsm/assessment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
it 'shows the FI details' do
visit nsm_claim_claim_details_path(claim)

expect(page).to have_content "Sent back to provider on 4 July 2024\nTest Data"
expect(page).to have_content "Sent back to provider on 4 July 2024\nFurther information request:\nTest Data"
end
end

Expand Down
5 changes: 4 additions & 1 deletion spec/system/nsm/history_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
claim.state = 'sent_back'
Nsm::Event::SendBack.build(submission: claim, current_user: caseworker, previous_state: 'submitted',
comment: 'Send Back test')
claim.current_version = 2
Event::NewVersion.build(submission: claim)
claim.state = 'granted'
Event::Decision.build(submission: claim, current_user: caseworker, previous_state: 'sent_back',
comment: 'Decision test')
Expand All @@ -45,7 +47,8 @@
[
'case worker', 'Caseworker removed from claim by super visor', 'unassignment 2',
'case worker', 'Decision made to grant claim', 'Decision test',
'case worker', 'Claim sent back to provider', 'Send Back test',
'', 'Received', 'Received from Provider with further information',
'case worker', 'Sent back', 'Sent back to Provider for further information',
'case worker', 'Caseworker note', 'User test note',
'case worker', 'Claim risk changed to low risk', 'Risk change test',
'case worker', 'Self-assigned by case worker', 'Manual assignment note',
Expand Down

0 comments on commit a56cbb8

Please sign in to comment.