Skip to content

Commit 3c963ee

Browse files
committed
Add "Follow-up requested" row to session actions component
Shows patients with a follow-up requested consent status in the "Action required" section of the session overview, so nurses can see at a glance who needs a follow-up discussion.
1 parent b5f5a71 commit 3c963ee

5 files changed

Lines changed: 53 additions & 2 deletions

File tree

app/components/app_session_actions_component.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def rows
3030
no_nhs_number_row,
3131
unmatched_consent_row,
3232
no_consent_response_row,
33+
follow_up_requested_row,
3334
conflicting_consent_row,
3435
triage_required_row,
3536
register_attendance_row,
@@ -73,6 +74,24 @@ def no_consent_response_row
7374
generate_row(:children_with_no_consent_response, count:, href:, actions:)
7475
end
7576

77+
def follow_up_requested_row
78+
count =
79+
patients.has_programme_status(
80+
"needs_consent_follow_up_requested",
81+
programme: programmes,
82+
academic_year:
83+
).count
84+
85+
href =
86+
session_patients_path(
87+
session,
88+
programme_status_group: "needs_consent",
89+
programme_statuses: %w[needs_consent_follow_up_requested]
90+
)
91+
92+
generate_row(:children_with_follow_up_requested, count:, href:)
93+
end
94+
7695
def conflicting_consent_row
7796
count =
7897
patients.has_programme_status(

config/locales/countables.en.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ en:
2525
zero: No children to register
2626
one: 1 child to register
2727
other: "%{count} children to register"
28+
children_with_follow_up_requested:
29+
title: Follow-up requested
30+
zero: No children with follow-up requests
31+
one: 1 child with follow-up request
32+
other: "%{count} children with follow-up requests"
2833
children_with_conflicting_consent_response:
2934
title: Conflicting consent
3035
zero: No children with conflicting responses

spec/components/app_session_actions_component_spec.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
let(:allowed_managed_consent_reminders) { true }
1818

1919
before do
20+
create(
21+
:patient,
22+
:consent_follow_up_requested,
23+
:unknown_attendance,
24+
session:,
25+
year_group:
26+
)
2027
create(
2128
:patient,
2229
:consent_no_response,
@@ -59,17 +66,19 @@
5966
it { should have_text("No NHS number1 child") }
6067
it { should have_text("Unmatched response1 unmatched response") }
6168
it { should have_text("No consent response1 child") }
69+
it { should have_text("Follow-up requested1 child with follow-up request") }
6270
it { should have_text("Conflicting consent1 child") }
6371
it { should have_text("Triage needed1 child") }
64-
it { should have_text("Register attendance3 child") }
72+
it { should have_text("Register attendance4 child") }
6573
it { should have_text("Ready for vaccinator1 child for HPV") }
6674

6775
it { should have_link("1 child without an NHS number") }
6876
it { should have_link("1 unmatched response") }
6977
it { should have_link("1 child with no response") }
78+
it { should have_link("1 child with follow-up request") }
7079
it { should have_link("1 child with conflicting response") }
7180
it { should have_link("1 child requiring triage") }
72-
it { should have_link("3 children to register") }
81+
it { should have_link("4 children to register") }
7382
it { should have_link("1 child for HPV") }
7483

7584
it { should have_link("Send reminders") }

spec/factories/patient_programme_statuses.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
5353
status { "has_refusal_consent_conflicts" }
5454
end
5555

56+
trait :needs_consent_follow_up_requested do
57+
consent_status { "follow_up_requested" }
58+
status { "needs_consent_follow_up_requested" }
59+
end
60+
5661
trait :needs_triage do
5762
consent_status { "given" }
5863
consent_vaccine_methods { %w[injection] }

spec/factories/patients.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,19 @@
234234
end
235235
end
236236

237+
trait :consent_follow_up_requested do
238+
programme_statuses do
239+
programmes.map do |programme|
240+
association(
241+
:patient_programme_status,
242+
:needs_consent_follow_up_requested,
243+
patient: instance,
244+
programme:
245+
)
246+
end
247+
end
248+
end
249+
237250
trait :consent_no_response do
238251
programme_statuses do
239252
programmes.map do |programme|

0 commit comments

Comments
 (0)