Skip to content

Commit 06469bd

Browse files
committed
Rename Programme#has_multiple_delivery_methods?
This is incorrectly named as it's vaccine methods we want to check rather than delivery methods. Even for non-flu programmes, there are multiple delivery methods (intramuscular and subcutaneous).
1 parent 3981776 commit 06469bd

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

app/components/app_programme_status_tags_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def call
1313
programme_statuses.map do |programme, hash|
1414
status = hash[:status]
1515
vaccine_methods =
16-
(hash[:vaccine_methods] if programme.has_multiple_delivery_methods?)
16+
(hash[:vaccine_methods] if programme.has_multiple_vaccine_methods?)
1717
programme_status_tag(programme, status, vaccine_methods)
1818
end
1919
)

app/components/app_triage_form_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def builder = GOVUKDesignSystemFormBuilder::FormBuilder
2929
def fieldset_options
3030
text = "Is it safe to vaccinate #{patient.given_name}?"
3131
hint =
32-
if programme.has_multiple_delivery_methods?
32+
if programme.has_multiple_vaccine_methods?
3333
if triage_form.consented_to_injection_only?
3434
"The parent has consented to the injected vaccine only"
3535
elsif triage_form.consented_to_injection?

app/forms/triage_form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def save!
4141

4242
def status_and_vaccine_method_options
4343
safe_to_vaccinate_choices =
44-
if programme.has_multiple_delivery_methods?
44+
if programme.has_multiple_vaccine_methods?
4545
consented_vaccine_methods.map { |method| "safe_to_vaccinate_#{method}" }
4646
else
4747
["safe_to_vaccinate"]

app/helpers/consents_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def consent_status_tag(consent)
2222

2323
vaccine_method =
2424
if consent.vaccine_methods.present? &&
25-
consent.programme.has_multiple_delivery_methods?
25+
consent.programme.has_multiple_vaccine_methods?
2626
tag.span(
2727
Vaccine.human_enum_name(:method, consent.vaccine_methods.join("_")),
2828
class: "nhsuk-u-secondary-text-color"

app/models/programme.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ def birth_academic_years
7575

7676
def vaccine_methods = vaccines.map(&:method).uniq
7777

78-
def available_delivery_methods
79-
vaccines.flat_map(&:available_delivery_methods).uniq
80-
end
81-
82-
def available_delivery_sites
83-
vaccines.flat_map(&:available_delivery_sites).uniq
84-
end
85-
86-
def has_multiple_delivery_methods?
78+
def has_multiple_vaccine_methods?
8779
# TODO: Ideally this would work as below, however that doesn't work well
8880
# in a list as it results in N+1 issues, without deeply pre-fetching
8981
# the vaccines which is a lot of data.
9082

91-
# available_delivery_methods.length > 1
83+
# vaccine_methods.length > 1
9284

9385
flu?
9486
end
9587

88+
def available_delivery_methods
89+
vaccines.flat_map(&:available_delivery_methods).uniq
90+
end
91+
92+
def available_delivery_sites
93+
vaccines.flat_map(&:available_delivery_sites).uniq
94+
end
95+
9696
DOSE_SEQUENCES = {
9797
"flu" => 1,
9898
"hpv" => 1,

0 commit comments

Comments
 (0)