Browse Source

Display 2 previous question answers in the informative text

pull/338/head
Kat 3 years ago committed by MadeTech Dushan
parent
commit
574b2bbabe
  1. 5
      app/views/form/_interruption_screen_question.html.erb
  2. 2
      config/locales/en.yml
  3. 2
      spec/features/form/validations_spec.rb
  4. 2
      spec/fixtures/forms/2021_2022.json

5
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 %>

2
config/locales/en.yml

@ -144,7 +144,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:

2
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")

2
spec/fixtures/forms/2021_2022.json vendored

@ -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": {

Loading…
Cancel
Save