Skip to content

Commit a1693f7

Browse files
authored
Merge pull request #4562 from nhsuk/fix-national-old-psd
Fix HCAs unable to record vaccination if PSD exists
2 parents ea84846 + 8c7392a commit a1693f7

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

app/components/app_vaccinate_form_component.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ def show_supplied_by_user_id_inside_vaccine_method?(vaccine_method)
5959
end
6060

6161
def has_patient_specific_direction?(vaccine_method:)
62-
patient.has_patient_specific_direction?(
63-
academic_year:,
64-
programme:,
65-
team:,
66-
vaccine_method:
67-
)
62+
session.psd_enabled? &&
63+
patient.has_patient_specific_direction?(
64+
academic_year:,
65+
programme:,
66+
team:,
67+
vaccine_method:
68+
)
6869
end
6970

7071
def healthcare_assistant? = current_user.is_healthcare_assistant?

spec/features/flu_vaccination_hca_national_protocol_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
then_i_am_able_to_vaccinate_them(nasal: false)
2121
end
2222

23+
scenario "Administered by HCA under national protocol but had a previous PSD" do
24+
given_a_session_exists
25+
and_patients_exist
26+
and_the_nasal_and_injection_patient_has_a_psd
27+
28+
when_i_visit_the_session_record_tab
29+
then_i_see_all_the_patients
30+
31+
when_i_click_on_the_nasal_and_injection_patient
32+
then_i_am_able_to_vaccinate_them(nasal: true)
33+
end
34+
2335
scenario "Administered by HCA under national protocol with PSD enabled" do
2436
given_a_session_exists(psd_enabled: true)
2537
and_patients_exist

spec/features/flu_vaccination_hca_pgd_supply_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
then_i_am_not_able_to_vaccinate_them
2121
end
2222

23+
scenario "Administered by HCA under PGD supply, patient has previous PSD" do
24+
given_a_session_exists
25+
and_patients_exist
26+
and_the_nasal_only_patient_has_a_psd
27+
28+
when_i_visit_the_session_record_tab
29+
then_i_only_see_nasal_spray_patients
30+
31+
when_i_click_on_the_nasal_only_patient
32+
then_i_am_able_to_vaccinate_them_nasal_only
33+
end
34+
2335
scenario "Patient consents nasal, has health issues, and is triaged as safe to vaccinate" do
2436
given_a_session_exists
2537
and_a_nasal_patient_exists_with_health_issues_marked_safe_vaccinate_with_nasal
@@ -77,6 +89,15 @@ def and_patients_exist
7789
)
7890
end
7991

92+
def and_the_nasal_only_patient_has_a_psd
93+
create(
94+
:patient_specific_direction,
95+
patient: @patient_nasal_only,
96+
programme: @programme,
97+
team: @team
98+
)
99+
end
100+
80101
def and_a_nasal_patient_exists_with_health_issues_marked_safe_vaccinate_with_nasal
81102
@patient_nasal_only =
82103
create(

0 commit comments

Comments
 (0)