<%= govuk_summary_list(classes: "govuk-!-margin-bottom-9", html_attributes: { "data-test": "partner-bank-accounts" }) do |summary_list| %>
- <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__partner_online_current_accounts" }) do |row| %>
- <%= row.with_key(text: t(".assets.current_account"), classes: "govuk-!-width-one-half") %>
+ <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__partner_offline_current_accounts" }) do |row| %>
+ <%= row.with_key(text: t(".assets.partner_current_account"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { @legal_aid_application.savings_amount.partner_offline_current_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.partner_offline_current_accounts) : t("generic.none") } %>
<% end %>
- <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__partner_online_savings_accounts" }) do |row| %>
- <%= row.with_key(text: t(".assets.savings_account"), classes: "govuk-!-width-one-half") %>
+ <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__partner_offline_savings_accounts" }) do |row| %>
+ <%= row.with_key(text: t(".assets.partner_savings_account"), classes: "govuk-!-width-one-half") %>
<%= row.with_value { @legal_aid_application.savings_amount.partner_offline_savings_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.partner_offline_savings_accounts) : t("generic.none") } %>
<% end %>
<% end %>
- <% end %>
- <% if @legal_aid_application&.savings_amount&.has_joint_values? %>
-
-
-
<%= t(".assets.joint_bank_accounts") %>
-
- <% if read_only == false %>
-
-
- <%= govuk_link_to(
- t("generic.change"),
- check_answer_url_for(journey_type, :offline_accounts, @legal_aid_application),
- "aria-label": "#{t('generic.change')} #{t('.assets.joint_bank_accounts')} values",
- ) %>
-
+ <% if @legal_aid_application.uploading_bank_statements? || !@legal_aid_application.non_passported? %>
+
+
+
<%= t(".assets.joint_bank_accounts") %>
- <% end %>
-
- <%= govuk_summary_list(classes: "govuk-!-margin-bottom-9", html_attributes: { "data-test": "joint-bank-accounts" }) do |summary_list| %>
- <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__joint_online_current_accounts" }) do |row| %>
- <%= row.with_key(text: t(".assets.current_account"), classes: "govuk-!-width-one-half") %>
- <%= row.with_value { @legal_aid_application.savings_amount.joint_offline_current_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.joint_offline_current_accounts) : t("generic.none") } %>
- <% end %>
- <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__joint_online_savings_accounts" }) do |row| %>
- <%= row.with_key(text: t(".assets.savings_account"), classes: "govuk-!-width-one-half") %>
- <%= row.with_value { @legal_aid_application.savings_amount.joint_offline_savings_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.joint_offline_savings_accounts) : t("generic.none") } %>
+ <% if read_only == false %>
+
+
+ <%= govuk_link_to(
+ t("generic.change"),
+ check_answer_url_for(journey_type, :offline_accounts, @legal_aid_application),
+ "aria-label": "#{t('generic.change')} #{t('.assets.joint_bank_accounts')} values",
+ ) %>
+
+
+ <% end %>
+
+ <%= govuk_summary_list(classes: "govuk-!-margin-bottom-9", html_attributes: { "data-test": "joint-bank-accounts" }) do |summary_list| %>
+ <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__joint_offline_current_accounts" }) do |row| %>
+ <%= row.with_key(text: t(".assets.joint_current_account"), classes: "govuk-!-width-one-half") %>
+ <%= row.with_value { @legal_aid_application.savings_amount.joint_offline_current_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.joint_offline_current_accounts) : t("generic.none") } %>
+ <% end %>
+ <%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__joint_offline_savings_accounts" }) do |row| %>
+ <%= row.with_key(text: t(".assets.joint_savings_account"), classes: "govuk-!-width-one-half") %>
+ <%= row.with_value { @legal_aid_application.savings_amount.joint_offline_savings_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.joint_offline_savings_accounts) : t("generic.none") } %>
+ <% end %>
<% end %>
<% end %>
<% end %>
diff --git a/config/locales/cy/shared.yml b/config/locales/cy/shared.yml
index 5950e4771b..75492725d9 100644
--- a/config/locales/cy/shared.yml
+++ b/config/locales/cy/shared.yml
@@ -117,8 +117,8 @@ cy:
policy_disregards: seitirahc ro emehcs morf stnemyaP
savings_and_investments: "?evah tneilc ruoy seod stnemtsevni ro sgnivas
fo sepyt hcihW"
- savings_account: tnuocca sgnivaS
- current_account: tnuocca tnerruC
+ client_savings_account: tnuocca sgnivaS
+ client_current_account: tnuocca tnerruC
bank_accounts: "?evah tneilc ruoy seod stnuocca knab hcihW"
property:
outstanding_mortgage: "?emoh s'tneilc ruoy no egagtrom gnidnatstuo eht si
diff --git a/config/locales/en/shared.yml b/config/locales/en/shared.yml
index f503d54f6d..67086ecaef 100644
--- a/config/locales/en/shared.yml
+++ b/config/locales/en/shared.yml
@@ -242,9 +242,13 @@ en:
policy_disregards: Payments from scheme or charities
savings_and_investments: Which savings or investments does your client have?
savings_and_investments_with_partner: Which savings or investments does either your client or their partner have?
- savings_account: Savings account
- current_account: Current account
bank_accounts: Bank accounts
+ client_current_account: Client's current accounts
+ client_savings_account: Client's savings accounts
+ partner_savings_account: Partner's savings accounts
+ partner_current_account: Partner's current accounts
+ joint_savings_account: Joint savings accounts
+ joint_current_account: Joint current accounts
client_bank_accounts: Your client's accounts
partner_bank_accounts: The partner's accounts
joint_bank_accounts: Joint accounts
@@ -261,7 +265,7 @@ en:
percentage_home: What percentage of the home does your client legally own?
percentage_home_with_partner: What percentage of the home do your client and their partner legally own?
offline_savings_accounts:
- heading: Does your client have any savings accounts they cannot access online?
+ heading: Your client's accounts
offline_savings_accounts: Has savings accounts they cannot access online
offline_savings_amount: Amount in offline savings accounts
bank_transaction_table:
@@ -583,16 +587,16 @@ en:
hint:
check_box_valuable_items_value: For example, jewellery, art or antiques – do not include wedding or engagement rings, furniture, clothing or tools used for work.
offline_accounts:
- check_box_offline_current_accounts: Current account
- check_box_offline_savings_accounts: Savings account
+ check_box_offline_current_accounts: Client's current accounts
+ check_box_offline_savings_accounts: Client's savings accounts
hint:
revealing_check_box_offline_current_accounts: Include accounts with a negative balance or no money in them.
revealing_check_box_offline_savings_accounts: Include accounts with a negative balance or no money in them.
offline_current_accounts: Enter the total in all current accounts
offline_savings_accounts: Enter the total in all savings accounts
bank_accounts:
- check_box_offline_current_accounts: Current account
- check_box_offline_savings_accounts: Savings account
+ check_box_offline_current_accounts: Client's current accounts
+ check_box_offline_savings_accounts: Client's savings accounts
hint:
revealing_check_box_offline_current_accounts: If your client has multiple accounts, take the lowest balance from each account last month, add them, then enter the total
offline_current_accounts: Enter the lowest balance last month
diff --git a/features/providers/bank_statement_upload/check_your_means_answers.feature b/features/providers/bank_statement_upload/check_your_means_answers.feature
index 29d639639c..33b1d2a18d 100644
--- a/features/providers/bank_statement_upload/check_your_means_answers.feature
+++ b/features/providers/bank_statement_upload/check_your_means_answers.feature
@@ -36,7 +36,7 @@ Feature: Bank statement upload check your answers
And I should see "Uploaded bank statements"
And I should see 'Does your client get student finance?'
- And I should not see 'Does your client have any savings accounts they cannot access online?'
+ And I should not see "Your client's accounts"
And the "Payments your client receives" section's questions and answers should match:
| question | answer |
diff --git a/features/providers/check_your_answers.feature b/features/providers/check_your_answers.feature
index cbc727b3e4..237b967f96 100644
--- a/features/providers/check_your_answers.feature
+++ b/features/providers/check_your_answers.feature
@@ -74,7 +74,7 @@ Feature: Checking answers backwards and forwards
Then I visit the applications page
Then I view the previously created application
Then I am on the check your answers page for other assets
- And I click Check Your Answers Change link for 'bank accounts'
+ And I click Check Your Answers Change link for 'offline accounts link'
Then I should be on a page showing 'Which bank accounts does your client have?'
Then I select 'Savings account'
Then I fill 'offline_savings_accounts' with '678.99'
@@ -89,7 +89,7 @@ Feature: Checking answers backwards and forwards
Then I visit the applications page
Then I view the previously created application
Then I am on the check your answers page for other assets
- And I click Check Your Answers Change link for 'bank accounts'
+ And I click Check Your Answers Change link for 'offline accounts link'
Then I should be on a page showing "Which bank accounts does your client have?"
Then I select 'None of these'
Then I click 'Save and continue'
@@ -207,7 +207,7 @@ Feature: Checking answers backwards and forwards
@javascript
Scenario: I want to view bank accounts via the capital check your answers page
Given I complete the passported journey as far as capital check your answers
- And I click Check Your Answers Change link for 'bank accounts'
+ And I click Check Your Answers Change link for 'offline accounts link'
Then I should be on a page showing "Which bank accounts does your client have?"
Then I select 'None of these'
Then I click 'Save and continue'
@@ -315,7 +315,7 @@ Feature: Checking answers backwards and forwards
| h2 | Your client's capital |
| h3 | Property |
| h3 | Vehicles |
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts |
| h2 | Which savings or investments does your client have? |
| h2 | Which assets does your client have? |
| h2 | Restrictions on your client's assets |
@@ -348,7 +348,7 @@ Feature: Checking answers backwards and forwards
| h2 | Your client's capital |
| h3 | Property |
| h3 | Vehicles |
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts |
| h2 | Which savings or investments does your client have? |
| h2 | Which assets does your client have? |
| h2 | Restrictions on your client's assets |
diff --git a/features/providers/means_report.feature b/features/providers/means_report.feature
index 2ad7cf97d6..5b21e928a2 100644
--- a/features/providers/means_report.feature
+++ b/features/providers/means_report.feature
@@ -28,7 +28,7 @@ Feature: Means report
| h3 | Bank statements |
Then the following sections should not exist:
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts |
Then the following sections should not exist:
| tag | section |
@@ -134,8 +134,8 @@ Feature: Means report
And the "Bank accounts", for static bank account totals, questions should exist:
| question |
- | Current account |
- | Savings account |
+ | Client's current accounts |
+ | Client's savings accounts |
And the "Which savings or investments does your client have?" questions should exist:
| question |
@@ -193,7 +193,7 @@ Feature: Means report
| h3 | Property |
| h3 | Vehicles |
| h2 | Bank accounts |
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts |
| h2 | Property, savings and other assets |
| h2 | Which savings or investments does your client have? |
| h2 | Which assets does your client have? |
@@ -302,10 +302,10 @@ Feature: Means report
And the "Bank accounts", for open banking accounts, questions should exist:
| question |
- | Current account |
- | Savings account |
+ | Client's current accounts |
+ | Client's savings accounts |
- And the "Does your client have any savings accounts they cannot access online?" questions should exist:
+ And the "Your client's accounts" questions should exist:
| question |
| Has savings accounts they cannot access online |
| Amount in offline savings accounts |
@@ -409,7 +409,7 @@ Feature: Means report
| h2 | Restrictions on your client's assets |
| h2 | Payments from scheme or charities |
| h3 | Bank statements |
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts|
And the "Client details" check your answers section should contain:
| question | answer |
diff --git a/features/providers/review_and_print.feature b/features/providers/review_and_print.feature
index 877f37e622..9bbb65a55a 100644
--- a/features/providers/review_and_print.feature
+++ b/features/providers/review_and_print.feature
@@ -98,7 +98,7 @@ Feature: Review and print your application
| h3 | Property |
| h3 | Vehicles |
| h2 | Bank accounts |
- | h3 | Does your client have any savings accounts they cannot access online? |
+ | h3 | Your client's accounts |
| h2 | Which savings or investments does your client have? |
| h2 | Which assets does your client have? |
| h2 | Restrictions on your client's assets |
diff --git a/features/step_definitions/means_report_steps.rb b/features/step_definitions/means_report_steps.rb
index 0259d83032..c0251e3954 100644
--- a/features/step_definitions/means_report_steps.rb
+++ b/features/step_definitions/means_report_steps.rb
@@ -230,7 +230,7 @@
expect_questions_in(selector: "[data-test=\"applicant-bank-accounts\"]", expected: table)
end
-Then("the \"Does your client have any savings accounts they cannot access online?\" questions should exist:") do |table|
+Then("the \"Your client's accounts\" questions should exist:") do |table|
expect_questions_in(selector: "[data-test=\"offline-savings-accounts\"]", expected: table)
end
diff --git a/spec/requests/providers/check_capital_answers_controller_spec.rb b/spec/requests/providers/check_capital_answers_controller_spec.rb
index 675036ff51..302b9ca113 100644
--- a/spec/requests/providers/check_capital_answers_controller_spec.rb
+++ b/spec/requests/providers/check_capital_answers_controller_spec.rb
@@ -96,7 +96,7 @@
context "and they have offline bank_accounts" do
it "shows the partner bank values" do
expect(page).to have_css("#app-check-your-answers__partner_offline_savings_accounts",
- text: "The partner's accounts")
+ text: "Partner's savings accounts")
end
end
end
From 526ac294f0abdae1e36844b391bc1bc5ce1667b5 Mon Sep 17 00:00:00 2001
From: Adam Goldstone <13471320+agoldstone93@users.noreply.github.com>
Date: Wed, 18 Oct 2023 15:11:39 +0100
Subject: [PATCH 6/6] AP-3809: Add safe navigation operator to client bank
accounts Add back in safe navigation operator. Update spec to properly test
for nil savings by adding trait to test for when none_selected is true
---
app/helpers/capital_helper.rb | 5 -----
app/views/shared/check_answers/_assets.html.erb | 4 ++--
spec/factories/legal_aid_applications.rb | 4 ++++
spec/factories/savings_amounts.rb | 1 +
spec/requests/providers/check_passported_answers_spec.rb | 1 +
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/app/helpers/capital_helper.rb b/app/helpers/capital_helper.rb
index 68a1941d99..42c7e275d7 100644
--- a/app/helpers/capital_helper.rb
+++ b/app/helpers/capital_helper.rb
@@ -7,11 +7,6 @@ def capital_amounts_list(legal_aid_application, locale_namespace:, percentage_va
build_asset_list(attributes, locale_namespace, percentage_values)
end
- def capital_accounts_list(legal_aid_application, locale_namespace:, percentage_values: [])
- attributes = capital_amount_attributes(legal_aid_application.savings_amount, legal_aid_application)&.reject! { |a| !a.end_with?("accounts") }
- build_asset_list(attributes, locale_namespace, percentage_values)
- end
-
def capital_assets_list(legal_aid_application, locale_namespace:, percentage_values: [])
attributes = capital_amount_attributes(legal_aid_application.savings_amount, legal_aid_application)&.reject! { |a| a.end_with?("accounts") }
build_asset_list(attributes, locale_namespace, percentage_values)
diff --git a/app/views/shared/check_answers/_assets.html.erb b/app/views/shared/check_answers/_assets.html.erb
index 3560b0f121..990fffdbc3 100644
--- a/app/views/shared/check_answers/_assets.html.erb
+++ b/app/views/shared/check_answers/_assets.html.erb
@@ -50,11 +50,11 @@
<%= govuk_summary_list(classes: "govuk-!-margin-bottom-9", html_attributes: { id: "app-check-your-answers__bank_accounts_items", "data-test": "applicant-bank-accounts" }) do |summary_list| %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__offline_current_accounts" }) do |row| %>
<%= row.with_key(text: t(".assets.client_current_account"), classes: "govuk-!-width-one-half") %>
- <%= row.with_value { @legal_aid_application.savings_amount.offline_current_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.offline_current_accounts) : t("generic.none") } %>
+ <%= row.with_value { @legal_aid_application&.savings_amount&.offline_current_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.offline_current_accounts) : t("generic.none") } %>
<% end %>
<%= summary_list.with_row(html_attributes: { id: "app-check-your-answers__offline_savings_accounts" }) do |row| %>
<%= row.with_key(text: t(".assets.client_savings_account"), classes: "govuk-!-width-one-half") %>
- <%= row.with_value { @legal_aid_application.savings_amount.offline_savings_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.offline_savings_accounts) : t("generic.none") } %>
+ <%= row.with_value { @legal_aid_application&.savings_amount&.offline_savings_accounts.present? ? gds_number_to_currency(@legal_aid_application.savings_amount.offline_savings_accounts) : t("generic.none") } %>
<% end %>
<% end %>
<% end %>
diff --git a/spec/factories/legal_aid_applications.rb b/spec/factories/legal_aid_applications.rb
index 7a3c1a044d..b799815705 100644
--- a/spec/factories/legal_aid_applications.rb
+++ b/spec/factories/legal_aid_applications.rb
@@ -496,6 +496,10 @@
savings_amount { build(:savings_amount, :with_values) }
end
+ trait :with_nil_savings_amount do
+ savings_amount { build(:savings_amount, :all_nil) }
+ end
+
trait :with_fixed_offline_savings_accounts do
savings_amount { build(:savings_amount, :all_zero, offline_savings_accounts: 1001) }
end
diff --git a/spec/factories/savings_amounts.rb b/spec/factories/savings_amounts.rb
index d2ffe5874f..cb9ac65160 100644
--- a/spec/factories/savings_amounts.rb
+++ b/spec/factories/savings_amounts.rb
@@ -20,6 +20,7 @@
trait :all_nil do
offline_current_accounts { nil }
offline_savings_accounts { nil }
+ none_selected { true }
cash { nil }
other_person_account { nil }
national_savings { nil }
diff --git a/spec/requests/providers/check_passported_answers_spec.rb b/spec/requests/providers/check_passported_answers_spec.rb
index 42c7e11170..a0c9bcc975 100644
--- a/spec/requests/providers/check_passported_answers_spec.rb
+++ b/spec/requests/providers/check_passported_answers_spec.rb
@@ -125,6 +125,7 @@
let(:application) do
create(:legal_aid_application,
:with_applicant,
+ :with_nil_savings_amount,
:with_proceedings,
:with_policy_disregards,
:without_own_home,