Skip to content

Commit e1d7ad7

Browse files
authored
Merge pull request #3532 from nhsuk/patient-cards-in-session-lists-should-show-a-status-name
Patient cards in session lists should show a status name
2 parents 4a4a26e + 461f027 commit e1d7ad7

File tree

5 files changed

+56
-24
lines changed

5 files changed

+56
-24
lines changed

app/components/app_patient_session_search_result_card_component.rb

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class AppPatientSessionSearchResultCardComponent < ViewComponent::Base
2525
2626
if status_tag
2727
summary_list.with_row do |row|
28-
row.with_key { "Status" }
29-
row.with_value { status_tag }
28+
row.with_key { I18n.t(status_tag[:key], scope: %i[status label]) }
29+
row.with_value { status_tag[:value] }
3030
end
3131
end
3232
end %>
@@ -100,27 +100,54 @@ def status_tag
100100

101101
case context
102102
when :register
103-
render AppRegisterStatusTagComponent.new(
104-
patient_session.registration_status&.status || "unknown"
105-
)
103+
{
104+
key: :register,
105+
value:
106+
render(
107+
AppRegisterStatusTagComponent.new(
108+
patient_session.registration_status&.status || "unknown"
109+
)
110+
)
111+
}
106112
when :consent
107-
statuses =
108-
patient_session.programmes.index_with do |programme|
109-
patient.consent_status(programme:).status
110-
end
111-
render AppProgrammeStatusTagsComponent.new(statuses, outcome: :consent)
113+
{
114+
key: :consent,
115+
value:
116+
render(
117+
AppProgrammeStatusTagsComponent.new(
118+
patient_session.programmes.index_with do |programme|
119+
patient.consent_status(programme:).status
120+
end,
121+
outcome: :consent
122+
)
123+
)
124+
}
112125
when :triage
113-
statuses =
114-
patient_session.programmes.index_with do |programme|
115-
patient.triage_status(programme:).status
116-
end
117-
render AppProgrammeStatusTagsComponent.new(statuses, outcome: :triage)
126+
{
127+
key: :triage,
128+
value:
129+
render(
130+
AppProgrammeStatusTagsComponent.new(
131+
patient_session.programmes.index_with do |programme|
132+
patient.triage_status(programme:).status
133+
end,
134+
outcome: :triage
135+
)
136+
)
137+
}
118138
else
119-
statuses =
120-
patient_session.programmes.index_with do |programme|
121-
patient_session.session_status(programme:).status
122-
end
123-
render AppProgrammeStatusTagsComponent.new(statuses, outcome: :session)
139+
{
140+
key: :session,
141+
value:
142+
render(
143+
AppProgrammeStatusTagsComponent.new(
144+
patient_session.programmes.index_with do |programme|
145+
patient_session.session_status(programme:).status
146+
end,
147+
outcome: :session
148+
)
149+
)
150+
}
124151
end
125152
end
126153
end

app/components/app_search_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AppSearchComponent < ViewComponent::Base
3030
<% end %>
3131
3232
<% if triage_statuses.any? %>
33-
<%= f.govuk_radio_buttons_fieldset :triage_status, legend: { text: "Triage outcome", size: "s" } do %>
33+
<%= f.govuk_radio_buttons_fieldset :triage_status, legend: { text: "Triage status", size: "s" } do %>
3434
<%= f.govuk_radio_button :triage_status, "", label: { text: "Any" } %>
3535
<% triage_statuses.each do |status| %>
3636
<%= f.govuk_radio_button :triage_status, status, label: { text: t(status, scope: %i[status triage label]) } %>
@@ -48,7 +48,7 @@ class AppSearchComponent < ViewComponent::Base
4848
<% end %>
4949
5050
<% if session_statuses.any? %>
51-
<%= f.govuk_radio_buttons_fieldset :session_status, legend: { text: "Vaccination status", size: "s" } do %>
51+
<%= f.govuk_radio_buttons_fieldset :session_status, legend: { text: "Session outcome", size: "s" } do %>
5252
<%= f.govuk_radio_button :session_status, "", label: { text: "Any" } %>
5353
<% session_statuses.each do |status| %>
5454
<%= f.govuk_radio_button :session_status, status, label: { text: t(status, scope: %i[status session label]) } %>

config/locales/status.en.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
en:
22
status:
3+
label:
4+
consent: Consent status
5+
triage: Triage status
6+
register: Registration status
7+
session: Session outcome
38
consent:
49
label:
510
conflicts: Conflicting consent

spec/components/app_patient_session_search_result_card_component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
it { should have_link("SELDON, Hari", href:) }
2929
it { should have_text("Year 8") }
30-
it { should have_text("Status") }
30+
it { should have_text("Consent status") }
3131

3232
context "when context is register" do
3333
let(:context) { :register }

spec/features/hpv_vaccination_delayed_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def when_i_go_to_the_outcome_tab
107107
end
108108

109109
def then_i_see_the_patient_has_no_outcome_yet
110-
expect(page).to have_content("Status\nHPVUnwell")
110+
expect(page).to have_content("Session outcome\nHPVUnwell")
111111
end
112112

113113
def when_vaccination_confirmations_are_sent

0 commit comments

Comments
 (0)