From daa817c574963eb638431c6cc702c272e184e4a3 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Thu, 14 Mar 2024 15:12:29 +0000 Subject: [PATCH 1/5] CLDC-3279: Ignore reasonother field in bulk upload if reason is not other (#2291) --- .../bulk_upload/lettings/year2024/row_parser.rb | 6 +++++- .../lettings/year2024/row_parser_spec.rb | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index e03fd4817..8b5fe8f3c 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -1192,7 +1192,7 @@ private attributes["layear"] = field_96 attributes["waityear"] = field_97 attributes["reason"] = field_98 - attributes["reasonother"] = field_99 + attributes["reasonother"] = field_99 if reason_is_other? attributes["prevten"] = field_100 attributes["homeless"] = field_101 @@ -1570,4 +1570,8 @@ private def is_carehome field_124.present? ? 1 : 0 end + + def reason_is_other? + field_98 == 20 + end end diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index cd398dabd..f99052d99 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -2223,10 +2223,20 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end describe "#reasonother" do - let(:attributes) { { bulk_upload:, field_99: "some other reason" } } + context "when reason is 'other'" do + let(:attributes) { { bulk_upload:, field_98: "20", field_99: "some other reason" } } - it "sets value to given free text string" do - expect(parser.log.reasonother).to eql("some other reason") + it "is set to given free text string" do + expect(parser.log.reasonother).to eql("some other reason") + end + end + + context "when reason is not 'other'" do + let(:attributes) { { bulk_upload:, field_98: "50", field_99: "some other reason" } } + + it "is set to nil" do + expect(parser.log.reasonother).to be_nil + end end end From b48706acac5fffc52d65303a1a37f51b7d31a734 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:28:21 +0000 Subject: [PATCH 2/5] CLDC-3235 Update how we display create new logs actions (#2273) * Update display_actions * Display banner when org holds no stock * Check if current org DSA is signed --- .../create_log_actions_component.rb | 3 +- ...rotection_confirmation_banner_component.rb | 17 +++- app/models/organisation.rb | 8 ++ .../create_log_actions_component_spec.rb | 42 +++++++++- ...tion_confirmation_banner_component_spec.rb | 82 +++++++++++++++++++ 5 files changed, 146 insertions(+), 6 deletions(-) diff --git a/app/components/create_log_actions_component.rb b/app/components/create_log_actions_component.rb index 11c63c3a9..4b451c2cc 100644 --- a/app/components/create_log_actions_component.rb +++ b/app/components/create_log_actions_component.rb @@ -14,9 +14,8 @@ class CreateLogActionsComponent < ViewComponent::Base def display_actions? return false if bulk_upload.present? return true if user.support? - return false if !user.organisation.holds_own_stock? && user.organisation.stock_owners.empty? && user.organisation.absorbed_organisations.empty? - user.organisation.data_protection_confirmed? + user.organisation.data_protection_confirmed? && user.organisation.organisation_or_stock_owner_signed_dsa_and_holds_own_stock? end def create_button_href diff --git a/app/components/data_protection_confirmation_banner_component.rb b/app/components/data_protection_confirmation_banner_component.rb index 745c79e20..7ce852ae0 100644 --- a/app/components/data_protection_confirmation_banner_component.rb +++ b/app/components/data_protection_confirmation_banner_component.rb @@ -13,13 +13,16 @@ class DataProtectionConfirmationBannerComponent < ViewComponent::Base def display_banner? return false if user.support? && organisation.blank? return true if org_without_dpo? + return false if !org_or_user_org.holds_own_stock? && org_or_user_org.stock_owners.empty? && org_or_user_org.absorbed_organisations.empty? - !org_or_user_org.data_protection_confirmed? + !org_or_user_org.data_protection_confirmed? || !org_or_user_org.organisation_or_stock_owner_signed_dsa_and_holds_own_stock? end def header_text if org_without_dpo? "To create logs your organisation must state a data protection officer. They must sign the Data Sharing Agreement." + elsif !org_or_user_org.holds_own_stock? && org_or_user_org.data_protection_confirmed? + "Your organisation does not own stock. To create logs your stock owner(s) must accept the Data Sharing Agreement on CORE." elsif user.is_dpo? "Your organisation must accept the Data Sharing Agreement before you can create any logs." else @@ -28,7 +31,7 @@ class DataProtectionConfirmationBannerComponent < ViewComponent::Base end def banner_text - if org_without_dpo? || user.is_dpo? + if org_without_dpo? || user.is_dpo? || !org_or_user_org.holds_own_stock? govuk_link_to( link_text, link_href, @@ -50,13 +53,21 @@ private def link_text if dpo_required? "Contact helpdesk to assign a data protection officer" + elsif !org_or_user_org.holds_own_stock? && org_or_user_org.data_protection_confirmed? + "View or add stock owners" else "Read the Data Sharing Agreement" end end def link_href - dpo_required? ? GlobalConstants::HELPDESK_URL : data_sharing_agreement_organisation_path(org_or_user_org) + if dpo_required? + GlobalConstants::HELPDESK_URL + elsif !org_or_user_org.holds_own_stock? && org_or_user_org.data_protection_confirmed? + stock_owners_organisation_path(org_or_user_org) + else + data_sharing_agreement_organisation_path(org_or_user_org) + end end def dpo_required? diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 76d14dfde..0a852d2fd 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -159,4 +159,12 @@ class Organisation < ApplicationRecord def has_recent_absorbed_organisations? absorbed_organisations&.merged_during_open_collection_period.present? end + + def organisation_or_stock_owner_signed_dsa_and_holds_own_stock? + return true if data_protection_confirmed? && holds_own_stock? + return true if stock_owners.any? { |stock_owner| stock_owner.data_protection_confirmed? && stock_owner.holds_own_stock? } + return true if absorbed_organisations.any? { |stock_owner| stock_owner.data_protection_confirmed? && stock_owner.holds_own_stock? } + + false + end end diff --git a/spec/components/create_log_actions_component_spec.rb b/spec/components/create_log_actions_component_spec.rb index 6572c93f9..8444b939e 100644 --- a/spec/components/create_log_actions_component_spec.rb +++ b/spec/components/create_log_actions_component_spec.rb @@ -74,7 +74,7 @@ RSpec.describe CreateLogActionsComponent, type: :component do end context "when has data sharing agremeent" do - let(:user) { create(:user, :support) } + let(:user) { create(:user) } it "renders actions" do expect(component.display_actions?).to eq(true) @@ -114,6 +114,46 @@ RSpec.describe CreateLogActionsComponent, type: :component do expect(component.create_button_href).to eq("/sales-logs") end end + + context "when organisation doesn't own stock" do + before do + user.organisation.update!(holds_own_stock: false) + end + + context "and has signed DSA and stock owners have signed DSA" do + before do + parent_organisation = create(:organisation) + create(:organisation_relationship, child_organisation: user.organisation, parent_organisation:) + end + + it "renders actions" do + expect(component.display_actions?).to eq(true) + end + end + + context "and hasn't signed DSA and and stock owners have signed DSA" do + before do + user.organisation.data_protection_confirmation.update!(confirmed: false) + parent_organisation = create(:organisation) + create(:organisation_relationship, child_organisation: user.organisation, parent_organisation:) + end + + it "renders actions" do + expect(component.display_actions?).to eq(false) + end + end + + context "and no stock owners have signed data sharing agreement" do + before do + parent_organisation = create(:organisation, :without_dpc) + create(:organisation_relationship, child_organisation: user.organisation, parent_organisation:) + end + + it "does not render actions" do + expect(component.display_actions?).to eq(false) + end + end + end end end end diff --git a/spec/components/data_protection_confirmation_banner_component_spec.rb b/spec/components/data_protection_confirmation_banner_component_spec.rb index be10f9689..3064a1b8e 100644 --- a/spec/components/data_protection_confirmation_banner_component_spec.rb +++ b/spec/components/data_protection_confirmation_banner_component_spec.rb @@ -61,6 +61,24 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do expect(render).to have_selector("p", text: "Your organisation must accept the Data Sharing Agreement before you can create any logs.") end end + + context "and org doesn't own stock and has a parent organisation that hasn't signed DSA" do + before do + organisation.data_protection_confirmation.update!(confirmed: false) + organisation.update!(holds_own_stock: false) + parent_organisation = create(:organisation, :without_dpc, holds_own_stock: true) + create(:organisation_relationship, child_organisation: organisation, parent_organisation:) + end + + it "displays the banner and asks to sign" do + expect(component.display_banner?).to eq(true) + expect(render).to have_link( + "Read the Data Sharing Agreement", + href: "/organisations/#{organisation.id}/data-sharing-agreement", + ) + expect(render).to have_selector("p", text: "Your data protection officer must accept the Data Sharing Agreement on CORE before you can create any logs.") + end + end end context "when org has a signed data sharing agremeent" do @@ -68,6 +86,40 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do expect(component.display_banner?).to eq(false) expect(render.content).to be_empty end + + context "and doesn't own stock" do + before do + organisation.update!(holds_own_stock: false) + end + + context "and has a parent organisation that owns stock and has signed DSA" do + before do + parent_organisation = create(:organisation, holds_own_stock: true) + create(:organisation_relationship, child_organisation: organisation, parent_organisation:) + end + + it "does not display banner" do + expect(component.display_banner?).to eq(false) + expect(render.content).to be_empty + end + end + + context "and has a parent organisation that hasn't signed DSA" do + before do + parent_organisation = create(:organisation, :without_dpc, holds_own_stock: true) + create(:organisation_relationship, child_organisation: organisation, parent_organisation:) + end + + it "displays the banner and asks to create stock owners" do + expect(component.display_banner?).to eq(true) + expect(render).to have_link( + "View or add stock owners", + href: "/organisations/#{organisation.id}/stock-owners", + ) + expect(render).to have_selector("p", text: "Your organisation does not own stock. To create logs your stock owner(s) must accept the Data Sharing Agreement on CORE.") + end + end + end end context "when org does not have a DPO" do @@ -98,6 +150,20 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do expect(render).to have_selector("p", text: "Your data protection officer must accept the Data Sharing Agreement on CORE before you can create any logs.") expect(render).to have_selector("p", text: "You can ask: #{dpo.name}") end + + context "and has a parent organisation that owns stock and has signed DSA" do + before do + parent_organisation = create(:organisation, holds_own_stock: true) + create(:organisation_relationship, child_organisation: organisation, parent_organisation:) + end + + it "displays the banner and shows DPOs" do + expect(component.display_banner?).to eq(true) + expect(render.css("a")).to be_empty + expect(render).to have_selector("p", text: "Your data protection officer must accept the Data Sharing Agreement on CORE before you can create any logs.") + expect(render).to have_selector("p", text: "You can ask: #{dpo.name}") + end + end end context "when user is a DPO" do @@ -112,6 +178,22 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do ) expect(render).to have_selector("p", text: "Your organisation must accept the Data Sharing Agreement before you can create any logs.") end + + context "and has a parent organisation that owns stock and has signed DSA" do + before do + parent_organisation = create(:organisation, holds_own_stock: true) + create(:organisation_relationship, child_organisation: organisation, parent_organisation:) + end + + it "displays the banner and asks to sign" do + expect(component.display_banner?).to eq(true) + expect(render).to have_link( + "Read the Data Sharing Agreement", + href: "/organisations/#{organisation.id}/data-sharing-agreement", + ) + expect(render).to have_selector("p", text: "Your organisation must accept the Data Sharing Agreement before you can create any logs.") + end + end end end From 5937ae33282c2fe9852a782dc9bf96065e4a0286 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 15 Mar 2024 10:32:20 +0000 Subject: [PATCH 3/5] CLDC-3309: Update privacy notice/declaration error message for 2024 (#2315) * CLDC-3309: Update privacy notice/declaration error message for 2024 * Remove missing answer feature test * Remove unused definition --- .../form/lettings/questions/declaration.rb | 8 ++ app/models/form/question.rb | 3 - .../form/sales/questions/privacy_notice.rb | 9 +++ config/locales/en.yml | 8 +- spec/features/form/validations_spec.rb | 22 ------ .../lettings/questions/declaration_spec.rb | 10 ++- .../sales/questions/privacy_notice_spec.rb | 76 +++++++++++++++---- 7 files changed, 90 insertions(+), 46 deletions(-) diff --git a/app/models/form/lettings/questions/declaration.rb b/app/models/form/lettings/questions/declaration.rb index 7e1b0280d..0960e77cd 100644 --- a/app/models/form/lettings/questions/declaration.rb +++ b/app/models/form/lettings/questions/declaration.rb @@ -20,5 +20,13 @@ class Form::Lettings::Questions::Declaration < ::Form::Question { "declaration" => { "value" => declaration_text } }.freeze end + def unanswered_error_message + if form.start_year_after_2024? + I18n.t("validations.declaration.missing.post_2024") + else + I18n.t("validations.declaration.missing.pre_2024") + end + end + QUESTION_NUMBER_FROM_YEAR = { 2023 => 30, 2024 => 11 }.freeze end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 391771ad9..0a486b5bd 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -198,9 +198,6 @@ class Form::Question end def unanswered_error_message - return I18n.t("validations.declaration.missing") if id == "declaration" - return I18n.t("validations.privacynotice.missing") if id == "privacynotice" - I18n.t("validations.not_answered", question: error_display_label.downcase) end diff --git a/app/models/form/sales/questions/privacy_notice.rb b/app/models/form/sales/questions/privacy_notice.rb index 82c4c2a6c..ebb6b9434 100644 --- a/app/models/form/sales/questions/privacy_notice.rb +++ b/app/models/form/sales/questions/privacy_notice.rb @@ -20,6 +20,15 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question { "privacynotice" => { "value" => declaration_text } }.freeze end + def unanswered_error_message + buyer_or_buyers = @joint_purchase ? "buyers" : "buyer" + if form.start_year_after_2024? + I18n.t("validations.privacynotice.missing.post_2024", buyer_or_buyers:) + else + I18n.t("validations.privacynotice.missing.pre_2024", buyer_or_buyers:) + end + end + def guidance if form.start_year_after_2024? @joint_purchase ? "privacy_notice_buyer_2024_joint_purchase" : "privacy_notice_buyer_2024" diff --git a/config/locales/en.yml b/config/locales/en.yml index 8612e0367..487ceed1a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -567,10 +567,14 @@ en: joint_more_than_one_member: "There must be more than one person in the household as you've told us this is a joint tenancy" declaration: - missing: "You must show the DLUHC privacy notice to the tenant before you can submit this log." + missing: + pre_2024: "You must show the DLUHC privacy notice to the tenant before you can submit this log." + post_2024: "You must show or give access to the DLUHC privacy notice to the tenant before you can submit this log." privacynotice: - missing: "You must show the DLUHC privacy notice to the buyer before you can submit this log." + missing: + pre_2024: "You must show the DLUHC privacy notice to the %{buyer_or_buyers} before you can submit this log." + post_2024: "You must show or give access to the DLUHC privacy notice to the %{buyer_or_buyers} before you can submit this log." scheme: toggle_date: diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb index c674ea839..aba4f40f6 100644 --- a/spec/features/form/validations_spec.rb +++ b/spec/features/form/validations_spec.rb @@ -27,18 +27,6 @@ RSpec.describe "validations" do created_by: user, ) end - let(:completed_without_declaration) do - FactoryBot.create( - :lettings_log, - :completed, - created_by: user, - status: 1, - declaration: nil, - startdate: Time.zone.local(2021, 5, 1), - voiddate: Time.zone.local(2021, 5, 1), - mrcdate: Time.zone.local(2021, 5, 1), - ) - end let(:id) { lettings_log.id } before do @@ -199,14 +187,4 @@ RSpec.describe "validations" do end end end - - describe "Submission validation" do - context "when tenant has not seen the privacy notice" do - it "shows a warning" do - visit("/lettings-logs/#{completed_without_declaration.id}/declaration") - click_button("Save and continue") - expect(page).to have_content("You must show the DLUHC privacy notice to the tenant") - end - end - end end diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index e61258893..fae18e5bc 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -61,6 +61,10 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do it "has check_answers_card_number = 0" do expect(question.check_answers_card_number).to eq(0) end + + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the tenant before you can submit this log.") + end end context "when the form year is >= 2024" do @@ -81,9 +85,9 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do it "has check_answers_card_number nil" do expect(question.check_answers_card_number).to be_nil end - end - it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the tenant before you can submit this log.") + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the tenant before you can submit this log.") + end end end diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 95f2de544..879ca9a45 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -48,14 +48,38 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do allow(form).to receive(:start_year_after_2024?).and_return(false) end - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" }, - }) + context "and there is a single buyer" do + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "privacynotice" => { "value" => "The buyer has seen the DLUHC privacy notice" }, + }) + end + + it "uses the expected top guidance partial" do + expect(question.top_guidance_partial).to eq("privacy_notice_buyer") + end + + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyer before you can submit this log.") + end end - it "uses the expected top guidance partial" do - expect(question.top_guidance_partial).to eq("privacy_notice_buyer") + context "and there are joint buyers" do + subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) } + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "privacynotice" => { "value" => "The buyers have seen the DLUHC privacy notice" }, + }) + end + + it "uses the expected top guidance partial" do + expect(question.top_guidance_partial).to eq("privacy_notice_buyer_joint_purchase") + end + + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyers before you can submit this log.") + end end end @@ -64,18 +88,38 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do allow(form).to receive(:start_year_after_2024?).and_return(true) end - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "privacynotice" => { "value" => "The buyer has seen or been given access to the DLUHC privacy notice" }, - }) - end + context "and there is a single buyer" do + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "privacynotice" => { "value" => "The buyer has seen or been given access to the DLUHC privacy notice" }, + }) + end + + it "uses the expected top guidance partial" do + expect(question.top_guidance_partial).to eq("privacy_notice_buyer_2024") + end - it "uses the expected top guidance partial" do - expect(question.top_guidance_partial).to eq("privacy_notice_buyer_2024") + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the buyer before you can submit this log.") + end end - end - it "returns correct unanswered_error_message" do - expect(question.unanswered_error_message).to eq("You must show the DLUHC privacy notice to the buyer before you can submit this log.") + context "and there are joint buyers" do + subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase: true) } + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "privacynotice" => { "value" => "The buyers have seen or been given access to the DLUHC privacy notice" }, + }) + end + + it "uses the expected top guidance partial" do + expect(question.top_guidance_partial).to eq("privacy_notice_buyer_2024_joint_purchase") + end + + it "returns correct unanswered_error_message" do + expect(question.unanswered_error_message).to eq("You must show or give access to the DLUHC privacy notice to the buyers before you can submit this log.") + end + end end end From bb5621ed7658b533972ee0c6b531cd8295d0f69a Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 15 Mar 2024 10:33:13 +0000 Subject: [PATCH 4/5] CLDC-3308: Enforce that the declaration has been answered before moving onto other sections in lettings logs (#2314) --- app/models/lettings_log.rb | 9 ++++++- spec/models/lettings_log_spec.rb | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index c8ab06b3d..584158000 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -581,7 +581,14 @@ class LettingsLog < Log end def non_location_setup_questions_completed? - [needstype, renewal, rent_type, startdate, owning_organisation_id, created_by_id].all?(&:present?) + form.setup_sections.all? do |section| + section.subsections.all? do |subsection| + relevant_qs = subsection.applicable_questions(self).reject { |q| optional_fields.include?(q.id) || %w[scheme_id location].include?(q.id) } + relevant_qs.all? do |question| + question.completed?(self) + end + end + end end def resolve! diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index d702a3805..41d9f0646 100644 --- a/spec/models/lettings_log_spec.rb +++ b/spec/models/lettings_log_spec.rb @@ -3507,5 +3507,45 @@ RSpec.describe LettingsLog do end end end + + describe "#non_location_setup_questions_completed" do + before do + Timecop.return + allow(FormHandler.instance).to receive(:current_lettings_form).and_call_original + Singleton.__init__(FormHandler) + end + + context "when setup section has been completed" do + let(:lettings_log) { build(:lettings_log, :setup_completed) } + + it "returns true" do + expect(lettings_log).to be_non_location_setup_questions_completed + end + end + + context "when the declaration has not been completed for a 2024 log" do + let(:lettings_log) { build(:lettings_log, :setup_completed, startdate: Time.utc(2024, 10, 1), declaration: nil) } + + it "returns false" do + expect(lettings_log).not_to be_non_location_setup_questions_completed + end + end + + context "when an optional question has not been completed" do + let(:lettings_log) { build(:lettings_log, :setup_completed, propcode: nil) } + + it "returns true" do + expect(lettings_log).to be_non_location_setup_questions_completed + end + end + + context "when scheme and location have not been completed" do + let(:lettings_log) { build(:lettings_log, :setup_completed, :sh, scheme_id: nil, location: nil) } + + it "returns true" do + expect(lettings_log).to be_non_location_setup_questions_completed + end + end + end end # rubocop:enable RSpec/MessageChain From dd500d3b8c32892cdd6bbe951beca00f11a31bb0 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:06:48 +0000 Subject: [PATCH 5/5] CLDC-2584 Update log summary component frontend (#2305) * feat: don't wrap log IDs * feat: divide log component into thirds not halves * feat: update scss and lettings log component styling * feat: update scss and sales log component styling * refactor: erblinting --- .../lettings_log_summary_component.html.erb | 18 ++++++------------ .../sales_log_summary_component.html.erb | 17 +++++++---------- app/frontend/styles/_log.scss | 12 ++++++++++-- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/components/lettings_log_summary_component.html.erb b/app/components/lettings_log_summary_component.html.erb index 1845a155f..a24ca6046 100644 --- a/app/components/lettings_log_summary_component.html.erb +++ b/app/components/lettings_log_summary_component.html.erb @@ -1,6 +1,6 @@
-
+

<%= govuk_link_to lettings_log_path(log) do %> @@ -8,20 +8,14 @@ <% end %>

<% if log.tenancycode? or log.propcode? %> - +
<% end %> <% if log.needstype? or log.startdate? %> @@ -51,7 +45,7 @@ <% end %>
-