Browse Source

Add the drop-down on Q16

CLDC-4461-hide-confidential-addresses
oscric 1 day ago
parent
commit
3d0a82cc39
  1. 12
      app/models/form/lettings/questions/address_search.rb
  2. 8
      app/services/bulk_upload/lettings/year2026/row_parser.rb
  3. 6
      app/views/form/guidance/_address_search.html.erb
  4. 4
      config/locales/forms/2026/lettings/guidance.en.yml
  5. 29
      spec/requests/form/address_search_guidance_spec.rb

12
app/models/form/lettings/questions/address_search.rb

@ -10,12 +10,6 @@ class Form::Lettings::Questions::AddressSearch < ::Form::Question
@hide_question_number_on_page = true
end
def unanswered_error_message(log = nil)
return super unless log&.is_supported_housing?
I18n.t("validations.lettings.property.address.not_answered_supported_housing")
end
def answer_options(log = nil, _user = nil)
return {} unless ActiveRecord::Base.connected?
return {} unless log&.address_search_options&.any?
@ -44,5 +38,11 @@ class Form::Lettings::Questions::AddressSearch < ::Form::Question
answer_options(log, user).transform_values { |value| value["value"] } || {}
end
def unanswered_error_message(log = nil)
return super unless log&.is_supported_housing?
I18n.t("validations.lettings.property.address.not_answered_supported_housing")
end
QUESTION_NUMBER_FROM_YEAR = { 2024 => 12, 2025 => 16, 2026 => 16 }.freeze
end

8
app/services/bulk_upload/lettings/year2026/row_parser.rb

@ -1579,16 +1579,16 @@ private
@scheme ||= Scheme.where(id: (owning_organisation.owned_schemes + managing_organisation.owned_schemes).map(&:id)).find_by_id_on_multiple_fields(field_5.strip, field_6)
end
def scheme_has_confidential_information?
scheme&.has_confidential_information? || false
end
def location
return if scheme.nil?
@location ||= scheme.locations.find_by_id_on_multiple_fields(field_6)
end
def scheme_has_confidential_information?
scheme&.has_confidential_information? || false
end
def startdate
year = field_10.to_s.strip.length.between?(1, 2) ? field_10 + 2000 : field_10
Date.new(year, field_9, field_8) if field_10.present? && field_9.present? && field_8.present?

6
app/views/form/guidance/_address_search.html.erb

@ -6,6 +6,12 @@
<%= I18n.t("forms.#{@log.form.start_date.year}.#{@log.form.type}.guidance.address_uprn.content").html_safe %>
<% end %>
<% if @log.form.type == "lettings" && @log.form.start_year_2026_or_later? %>
<%= govuk_details(summary_text: I18n.t("forms.#{@log.form.start_date.year}.#{@log.form.type}.guidance.confidential_supported_lettings.title")) do %>
<%= I18n.t("forms.#{@log.form.start_date.year}.#{@log.form.type}.guidance.confidential_supported_lettings.content").html_safe %>
<% end %>
<% end %>
<div class="govuk-button-group">
<%= govuk_link_to "Enter the address manually instead", address_manual_input_path(@log.log_type, @log.id), class: "govuk-button govuk-button--secondary" %>
</div>

4
config/locales/forms/2026/lettings/guidance.en.yml

@ -73,6 +73,10 @@ en:
content: "<p>The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and various industries across the UK. An example is 0010457355.</p>
<p>The UPRN may not be the same as the property reference assigned by your organisation.</p>"
confidential_supported_lettings:
title: "What should I do for confidential supported lettings?"
content: "Full address or UPRN is not required for confidential supported lettings. You are seeing this question because the scheme you chose in the ‘Set up this lettings log’ section does not have the ‘Confidential information’ box ticked. Please check the scheme you chose. If a scheme needs updating to mark it as confidential, a CORE coordinator in your organisation can do this. If you or they need further assistance contact the helpdesk."
needs_type:
title: "What does each need type mean?"
content: "General needs housing includes both self-contained and shared housing without support or specific adaptations.<br><br>Supported housing is housing with special design facilities or features targeted at a specific client group requiring support, for example housing designed for older people, sheltered accommodation, extra care housing. It can include direct access hostels, group homes, and purpose-built self-contained housing. We do not require CORE logs for residential care or nursing homes."

29
spec/requests/form/address_search_guidance_spec.rb

@ -0,0 +1,29 @@
require "rails_helper"
RSpec.describe "Address search bottom guidance", type: :request do
let(:user) { create(:user) }
before { sign_in user }
context "with a 2026 lettings log at the address search question" do
let(:lettings_log) { create(:lettings_log, :completed, assigned_to: user, manual_address_entry_selected: false) }
it "shows the confidential supported lettings guidance drop-down" do
get "/lettings-logs/#{lettings_log.id}/address-search"
expect(response).to have_http_status(:ok)
expect(response.body).to include("What should I do for confidential supported lettings?")
expect(response.body).to include("Full address or UPRN is not required for confidential supported lettings.")
end
end
context "with a 2026 sales log at the address search question" do
let(:sales_log) { create(:sales_log, :completed, assigned_to: user, manual_address_entry_selected: false) }
it "does not show the lettings confidential supported lettings guidance" do
get "/sales-logs/#{sales_log.id}/address-search"
expect(response.body).not_to include("What should I do for confidential supported lettings?")
end
end
end
Loading…
Cancel
Save