From 4aaad1dbfa802a081a3ea1c34d861aca364e6eb9 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 7 Mar 2022 16:59:43 +0000 Subject: [PATCH] Display 2 previous question answers in the informative text --- app/views/form/_interruption_screen_question.html.erb | 5 ++--- config/locales/en.yml | 2 +- spec/features/form/validations_spec.rb | 2 +- spec/fixtures/forms/2021_2022.json | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/form/_interruption_screen_question.html.erb b/app/views/form/_interruption_screen_question.html.erb index 5a6f7ee58..8071bf539 100644 --- a/app/views/form/_interruption_screen_question.html.erb +++ b/app/views/form/_interruption_screen_question.html.erb @@ -2,9 +2,8 @@ title_text: title_text, classes: 'app-panel--interruption', ) do %> - <% translation_question = case_log.form.get_question(informative_text["argument"]) %> - <% binding.pry %> - <%= I18n.t(informative_text["translation"], informative_text["argument"].to_sym => translation_question.answer_label(case_log)) %> + <% translation_question = informative_text["argument"].map {|x| case_log.form.get_question(x)} %> + <%= I18n.t(informative_text["translation"], informative_text["argument"][0].to_sym => translation_question[0].answer_label(case_log), informative_text["argument"][1].to_sym => translation_question[1].answer_label(case_log)) %> <%= f.govuk_radio_buttons_fieldset question.id.to_sym, legend: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe } do %> diff --git a/config/locales/en.yml b/config/locales/en.yml index d12912794..c155cab1a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -145,7 +145,7 @@ en: soft_validations: net_income: - hint_text: "This is based on the tenant’s work situation: %{ecstat1}" + hint_text: "This is based on the tenant’s work situation: %{ecstat1}\nThe household income you have entered is %{earnings}" in_soft_min_range: message: "Net income is lower than expected based on the main tenant’s working situation. Are you sure this is correct?" in_soft_max_range: diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb index 3a29fe7da..ba66e2814 100644 --- a/spec/features/form/validations_spec.rb +++ b/spec/features/form/validations_spec.rb @@ -132,7 +132,7 @@ RSpec.describe "validations" do expect(page).to have_current_path("/logs/#{case_log.id}/net-income-value-check") expect(page).to have_content("Net income is higher than expected based on the main tenant’s working situation") expect(page).to have_content("This is based on the tenant’s work situation: Full-time – 30 hours or more") - expect(page).to have_content("The household income you have entered is £750 every week") + expect(page).to have_content("The household income you have entered is £750.00 every week") choose("case-log-net-income-value-check-0-field", allow_label_click: true) click_button("Save and continue") expect(page).to have_current_path("/logs/#{case_log.id}/net-income-uc-proportion") diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index f4139c4ac..7675d9277 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -542,7 +542,7 @@ "title_text": "Net income is higher than expected based on the main tenant’s working situation", "informative_text": { "translation": "soft_validations.net_income.hint_text", - "argument": "ecstat1" + "argument": ["ecstat1", "earnings"] }, "questions": { "net_income_value_check": {