Skip to content

Commit 6c3ffb9

Browse files
authored
Merge pull request #3731 from nhsuk/next
Version 2.2.6
2 parents 9b462f0 + 89da637 commit 6c3ffb9

66 files changed

Lines changed: 1565 additions & 2093 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/continuous-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ run-name: Continuous deployment of ${{ github.ref_name }} to QA and Test
33

44
on:
55
push:
6-
branches: [main]
6+
branches: [next]
77

88
jobs:
99
test:

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/spec/examples.txt
9+
/test/tmp/
10+
/test/version_tmp/
11+
/tmp/
12+
13+
# Ignore Byebug command history file.
14+
.byebug_history
15+
16+
## Documentation cache and generated files:
17+
/.yardoc/
18+
/_yardoc/
19+
/doc/
20+
/rdoc/
21+
22+
## Environment normalization:
23+
/.bundle/
24+
/vendor/bundle
25+
/lib/bundler/man/
26+
127
*.log
228
.DS_Store
329
.bundle

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ awscli 2.13.31
55
terraform 1.11.4
66
tflint 0.55.1
77
pkl 0.28.1
8-
hk 1.0.0
8+
hk 1.1.2

app/components/app_backlink_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<nav <%= tag.attributes @attributes %>>
2-
<div class="nhsuk-back-link nhsuk-u-margin-top-4 nhsuk-u-margin-bottom-0">
2+
<div class="nhsuk-back-link">
33
<%= link_to @href, class: "nhsuk-back-link__link" do %>
44
<svg class="nhsuk-icon nhsuk-icon__chevron-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" height="24" width="24">
55
<path d="M8.5 12c0-.3.1-.5.3-.7l5-5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L10.9 12l4.3 4.3c.4.4.4 1 0 1.4s-1 .4-1.4 0l-5-5c-.2-.2-.3-.4-.3-.7z"></path>

app/components/app_consent_confirmation_component.rb

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@ def initialize(consent_form)
1414
end
1515

1616
def title
17-
case response
18-
when "given"
19-
"Consent confirmed"
20-
when "given_one"
21-
chosen_programme = chosen_programmes.first.name
22-
"Consent for the #{chosen_programme} vaccination confirmed"
23-
when "refused"
24-
"Consent refused"
17+
if response_given?
18+
if refused_programmes.empty?
19+
"Consent confirmed"
20+
else
21+
"Consent for the #{given_vaccinations} confirmed"
22+
end
2523
else
26-
raise "unrecognised consent response: #{response}"
24+
"Consent refused"
2725
end
2826
end
2927

3028
private
3129

32-
delegate :chosen_programmes,
33-
:not_chosen_programmes,
34-
:response,
30+
delegate :given_programmes,
31+
:refused_programmes,
32+
:response_given?,
3533
:parent_email,
3634
to: :@consent_form
3735

@@ -40,33 +38,26 @@ def full_name
4038
end
4139

4240
def panel_text
43-
case response
44-
when "given", "given_one"
41+
if response_given?
4542
if @consent_form.needs_triage?
4643
<<-END_OF_TEXT
4744
As you answered ‘yes’ to some of the health questions, we need to check
48-
the #{chosen_vaccinations_are} suitable for #{full_name}. We’ll review
45+
the #{given_vaccinations_are} suitable for #{full_name}. We’ll review
4946
your answers and get in touch again soon.
5047
END_OF_TEXT
5148
else
52-
"#{full_name} is due to get the #{chosen_vaccinations} at school" +
49+
"#{full_name} is due to get the #{given_vaccinations} at school" +
5350
(session_dates.present? ? " on #{session_dates}" : "")
5451
end
55-
when "refused"
56-
"You’ve told us that you do not want #{full_name} to get the" \
57-
" #{not_chosen_vaccinations} at school"
5852
else
59-
raise "unrecognised consent response: #{response}"
53+
"You’ve told us that you do not want #{full_name} to get the" \
54+
" #{refused_vaccinations} at school"
6055
end
6156
end
6257

63-
def chosen_vaccinations
64-
vaccinations_text(chosen_programmes)
65-
end
58+
def given_vaccinations = vaccinations_text(given_programmes)
6659

67-
def not_chosen_vaccinations
68-
vaccinations_text(not_chosen_programmes)
69-
end
60+
def refused_vaccinations = vaccinations_text(refused_programmes)
7061

7162
def vaccinations_text(programmes)
7263
programme_names =
@@ -79,8 +70,8 @@ def vaccinations_text(programmes)
7970
)
8071
end
8172

82-
def chosen_vaccinations_are
83-
"#{chosen_vaccinations} #{chosen_programmes.one? ? "is" : "are"}"
73+
def given_vaccinations_are
74+
"#{given_vaccinations} #{given_programmes.one? ? "is" : "are"}"
8475
end
8576

8677
def session_dates

app/components/app_patient_page_component.rb

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,8 @@ def vaccination_records
5656
end
5757

5858
def default_vaccinate_form
59-
today_pre_screenings =
60-
patient_session
61-
.pre_screenings
62-
.joins(:session_date)
63-
.merge(SessionDate.today)
64-
.order(created_at: :desc)
65-
66-
feeling_well = today_pre_screenings.any?(&:feeling_well) || nil
67-
not_pregnant = today_pre_screenings.any?(&:not_pregnant) || nil
59+
pre_screening_confirmed = patient.pre_screenings.today.exists?(programme:)
6860

69-
VaccinateForm.new(
70-
patient_session:,
71-
programme:,
72-
feeling_well:,
73-
not_pregnant:
74-
)
61+
VaccinateForm.new(patient_session:, programme:, pre_screening_confirmed:)
7562
end
7663
end

app/components/app_vaccinate_form_component.html.erb

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,67 @@
88
<% content_for(:before_content) { f.govuk_error_summary } %>
99

1010
<div class="nhsuk-card__content">
11-
<h2 class="nhsuk-card__heading nhsuk-heading-m">
12-
<%= patient.given_name %> has confirmed that they:
13-
</h2>
11+
<section>
12+
<h2 class="nhsuk-card__heading nhsuk-heading-m">
13+
Pre-screening checks
14+
</h2>
1415

15-
<%= f.govuk_check_boxes_fieldset :feeling_well, multiple: false, legend: nil do %>
16-
<%= f.govuk_check_box :feeling_well, true, multiple: false, link_errors: true %>
17-
<% end %>
16+
<p><%= patient.given_name %> has confirmed that they:</p>
1817

19-
<% if vaccinate_form.ask_not_pregnant? %>
20-
<%= f.govuk_check_boxes_fieldset :not_pregnant, multiple: false, legend: nil do %>
21-
<%= f.govuk_check_box :not_pregnant, true, multiple: false, link_errors: true %>
22-
<% end %>
23-
<% end %>
18+
<ul class="nhsuk-list nhsuk-list--bullet">
19+
<li>are not acutely unwell</li>
20+
<% if vaccinate_form.ask_not_pregnant? %>
21+
<li>are not pregnant</li>
22+
<% end %>
23+
<% if vaccinate_form.ask_not_taking_medication? %>
24+
<li>are not taking any medication which prevents vaccination</li>
25+
<% end %>
26+
<li>have no allergies which would prevent vaccination</li>
27+
<li>have not already had this vaccination</li>
28+
<li>know what the vaccination is for, and are happy to have it</li>
29+
</ul>
2430

25-
<% if vaccinate_form.ask_not_taking_medication? %>
26-
<%= f.govuk_check_boxes_fieldset :not_taking_medication, multiple: false, legend: nil do %>
27-
<%= f.govuk_check_box :not_taking_medication, true, multiple: false, link_errors: true %>
31+
<%= f.govuk_check_boxes_fieldset :pre_screening_confirmed, multiple: false, legend: nil do %>
32+
<%= f.govuk_check_box :pre_screening_confirmed, 1, 0, multiple: false, link_errors: true,
33+
label: { text: "#{patient.given_name} has confirmed the above statements are true" } %>
2834
<% end %>
29-
<% end %>
30-
31-
<%= f.govuk_check_boxes_fieldset :no_allergies, multiple: false, legend: nil do %>
32-
<%= f.govuk_check_box :no_allergies, true, multiple: false, link_errors: true %>
33-
<% end %>
3435

35-
<%= f.govuk_check_boxes_fieldset :not_already_had, multiple: false, legend: nil do %>
36-
<%= f.govuk_check_box :not_already_had, true, multiple: false, link_errors: true %>
37-
<% end %>
38-
39-
<%= f.govuk_check_boxes_fieldset :knows_vaccination, multiple: false, legend: nil do %>
40-
<%= f.govuk_check_box :knows_vaccination, true, multiple: false, link_errors: true %>
41-
<% end %>
42-
43-
<%= f.govuk_text_area :pre_screening_notes, label: { text: "Pre-screening notes (optional)" } %>
36+
<%= f.govuk_text_area :pre_screening_notes, label: { text: "Pre-screening notes (optional)" }, rows: 3 %>
37+
</section>
4438

4539
<hr class="nhsuk-section-break nhsuk-section-break--visible nhsuk-section-break--l">
4640

47-
<h2 class="nhsuk-card__heading nhsuk-heading-m">
48-
Is <%= patient.given_name %> ready for their <%= programme.name %> vaccination?
49-
</h2>
41+
<section>
42+
<h2 class="nhsuk-card__heading nhsuk-heading-m">
43+
Is <%= patient.given_name %> ready for their <%= programme.name %> vaccination?
44+
</h2>
45+
46+
<% hint = "Pre-screening checks must be completed for vaccination to go ahead" %>
5047

51-
<%= f.govuk_radio_buttons_fieldset :administered, legend: nil do %>
52-
<% if common_delivery_sites_options.length > 1 %>
53-
<%= f.govuk_radio_button :administered, true, label: { text: "Yes" }, link_errors: true do %>
54-
<%= f.govuk_collection_radio_buttons :delivery_site,
55-
common_delivery_sites_options,
56-
:value,
57-
:label,
58-
legend: {
59-
text: "Where will the injection be given?",
60-
size: "s",
61-
} %>
48+
<%= f.govuk_radio_buttons_fieldset :administered, legend: nil do %>
49+
<% if common_delivery_sites_options.length > 1 %>
50+
<%= f.govuk_radio_button :administered, true, label: { text: "Yes" }, hint: { text: hint }, link_errors: true do %>
51+
<%= f.govuk_collection_radio_buttons :delivery_site,
52+
common_delivery_sites_options,
53+
:value,
54+
:label,
55+
legend: {
56+
text: "Where will the injection be given?",
57+
size: "s",
58+
} %>
59+
<% end %>
60+
<% else %>
61+
<%= f.govuk_radio_button :administered, true, label: { text: "Yes" }, hint: { text: hint }, link_errors: true %>
62+
<%= f.hidden_field :delivery_site, value: common_delivery_sites_options.first.value %>
6263
<% end %>
63-
<% else %>
64-
<%= f.govuk_radio_button :administered, true, label: { text: "Yes" }, link_errors: true %>
65-
<%= f.hidden_field :delivery_site, value: common_delivery_sites_options.first.value %>
64+
<%= f.govuk_radio_button :administered, false, label: { text: "No" } %>
6665
<% end %>
67-
<%= f.govuk_radio_button :administered, false, label: { text: "No" } %>
68-
<% end %>
6966

70-
<%= f.hidden_field :delivery_method, value: delivery_method %>
71-
<%= f.hidden_field :dose_sequence, value: dose_sequence %>
72-
<%= f.hidden_field :programme_id, value: programme.id %>
67+
<%= f.hidden_field :delivery_method, value: delivery_method %>
68+
<%= f.hidden_field :dose_sequence, value: dose_sequence %>
69+
<%= f.hidden_field :programme_id, value: programme.id %>
7370

74-
<%= f.govuk_submit "Continue" %>
71+
<%= f.govuk_submit "Continue" %>
72+
</section>
7573
</div>
7674
<% end %>

app/controllers/concerns/consent_form_mailer_concern.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ module ConsentFormMailerConcern
44
extend ActiveSupport::Concern
55

66
def send_consent_form_confirmation(consent_form)
7-
if consent_form.consent_refused?
8-
send_consent_form_confirmation_refused(consent_form)
9-
else
7+
if consent_form.response_given?
108
ProgrammeGrouper
11-
.call(consent_form.chosen_programmes)
9+
.call(consent_form.given_programmes)
1210
.each_value do |programmes|
1311
if consent_form.needs_triage?
1412
EmailDeliveryJob.perform_later(
@@ -41,10 +39,12 @@ def send_consent_form_confirmation(consent_form)
4139
end
4240

4341
ProgrammeGrouper
44-
.call(consent_form.not_chosen_programmes)
42+
.call(consent_form.refused_programmes)
4543
.each_value do |programmes|
4644
send_consent_form_confirmation_refused(consent_form, programmes:)
4745
end
46+
else
47+
send_consent_form_confirmation_refused(consent_form)
4848
end
4949
end
5050

app/controllers/parent_interface/consent_forms/edit_controller.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class ConsentForms::EditController < ConsentForms::BaseController
1111
HOME_EDUCATED_SCHOOL_ID = "home-educated"
1212

1313
def show
14+
set_response if current_step == :consent
15+
1416
render_wizard
1517
end
1618

@@ -47,6 +49,7 @@ def update
4749
jump_to("contact-method", skip_to_confirm: true)
4850
end
4951
elsif current_step == :consent
52+
@consent_form.update_programme_responses
5053
@consent_form.seed_health_questions
5154
end
5255

@@ -94,7 +97,7 @@ def update_params
9497
parent_contact_method_type
9598
parent_contact_method_other_details
9699
],
97-
consent: %i[response chosen_vaccine],
100+
consent: %i[response chosen_programme],
98101
reason: %i[reason],
99102
reason_notes: %i[reason_notes],
100103
address: %i[address_line_1 address_line_2 address_town address_postcode]
@@ -122,6 +125,18 @@ def set_health_answer
122125
@health_answer = @consent_form.health_answers[@question_number]
123126
end
124127

128+
def set_response
129+
if @consent_form.response_given? && @consent_form.response_refused?
130+
@consent_form.response = "given_one"
131+
@consent_form.chosen_programme =
132+
@consent_form.given_programmes.first&.type
133+
elsif @consent_form.response_given?
134+
@consent_form.response = "given"
135+
elsif @consent_form.response_refused?
136+
@consent_form.response = "refused"
137+
end
138+
end
139+
125140
def validate_params
126141
case current_step
127142
when :date_of_birth

app/controllers/patient_sessions/vaccinations_controller.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ def vaccinate_form_params
5454
delivery_method
5555
delivery_site
5656
dose_sequence
57-
feeling_well
58-
knows_vaccination
59-
no_allergies
60-
not_already_had
61-
not_pregnant
62-
not_taking_medication
57+
pre_screening_confirmed
6358
pre_screening_notes
6459
vaccine_id
6560
]

0 commit comments

Comments
 (0)