Skip to content

Commit f9ba5cf

Browse files
committed
Don't ask follow up root questions in verbal consent
When recording health answers in verbal consent we don't want to ask for any questions that don't require notes as these have no effect on triage and instead we ask follow up questions which are the real questions. This is needed to support the asthma question for the flu programme where we ask about asthma, and then have some follow up questions. The asthma question alone has no impact on the triage result. Jira-Issue: MAV-1391
1 parent 17d5b7f commit f9ba5cf

4 files changed

Lines changed: 23 additions & 16 deletions

File tree

app/controllers/draft_consents_controller.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,13 @@ def handle_confirm
8787
end
8888

8989
def handle_questions
90-
questions_attrs = update_params.except(:wizard_step).values
91-
@draft_consent.health_answers.each_with_index do |ha, index|
92-
ha.assign_attributes(questions_attrs[index])
90+
questions_attrs = update_params.except(:wizard_step)
91+
92+
@draft_consent.health_answers.each_with_index do |health_answer, index|
93+
attributes = questions_attrs["question_#{index}"]
94+
if health_answer.requires_notes?
95+
health_answer.assign_attributes(attributes)
96+
end
9397
end
9498

9599
@draft_consent.assign_attributes(wizard_step: current_step)

app/models/draft_consent.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ def health_answers_are_valid
427427
return if health_answers.map(&:valid?).all?
428428

429429
health_answers.each_with_index do |health_answer, index|
430+
next unless health_answer.requires_notes?
431+
430432
health_answer.errors.messages.each do |field, messages|
431433
messages.each do |message|
432434
errors.add("question-#{index}-#{field}", message)

app/views/draft_consents/questions.html.erb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@
1515
<% content_for(:before_content) { f.govuk_error_summary } %>
1616

1717
<% @draft_consent.health_answers.each_with_index do |health_answer, index| %>
18-
<%= f.fields_for "question_#{index}", health_answer do |ff| %>
19-
<%= ff.govuk_radio_buttons_fieldset :question,
20-
legend: { size: "s", text: health_answer.question },
21-
hint: { text: health_answer.hint } do %>
22-
<%= ff.govuk_radio_button :response, "yes",
23-
label: { text: "Yes" },
24-
link_errors: true do %>
25-
<%= ff.govuk_text_area :notes,
26-
label: { text: "Give details" } %>
18+
<% if health_answer.requires_notes? %>
19+
<%= f.fields_for "question_#{index}", health_answer do |ff| %>
20+
<%= ff.govuk_radio_buttons_fieldset :question,
21+
legend: { size: "s", text: health_answer.question },
22+
hint: { text: health_answer.hint } do %>
23+
<%= ff.govuk_radio_button :response, "yes",
24+
label: { text: "Yes" },
25+
link_errors: true do %>
26+
<%= ff.govuk_text_area :notes, label: { text: "Give details" } %>
27+
<% end %>
28+
29+
<%= ff.govuk_radio_button :response, "no", label: { text: "No" } %>
2730
<% end %>
28-
<%= ff.govuk_radio_button :response, "no",
29-
label: { text: "No" } %>
3031
<% end %>
3132
<% end %>
3233
<% end %>

spec/features/verbal_consent_given_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ def when_i_record_that_verbal_consent_was_given
5959
def when_i_record_that_verbal_nasal_consent_was_given
6060
record_that_verbal_consent_was_given(
6161
consent_option: "Yes, for the nasal spray",
62-
number_of_health_questions: 10,
62+
number_of_health_questions: 9,
6363
triage_option: "Yes, it’s safe to vaccinate with nasal spray"
6464
)
6565
end
6666

6767
def when_i_record_that_verbal_nasal_and_injection_consent_was_given
6868
record_that_verbal_consent_was_given(
6969
consent_option: "Yes, for the nasal spray",
70-
number_of_health_questions: 11,
70+
number_of_health_questions: 10,
7171
triage_option: "Yes, it’s safe to vaccinate with nasal spray",
7272
injective_alternative: true
7373
)

0 commit comments

Comments
 (0)