diff --git a/.erb-lint.yml b/.erb_lint.yml
similarity index 100%
rename from .erb-lint.yml
rename to .erb_lint.yml
diff --git a/.rubocop.yml b/.rubocop.yml
index 7bc65bbd8..4a54015a2 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,5 +1,7 @@
require:
- rubocop-performance
+
+plugins:
- rubocop-rails
- rubocop-rspec
@@ -28,3 +30,6 @@ Rails/UnknownEnv:
- development
- test
- review
+
+RSpec/IndexedLet:
+ Enabled: false
diff --git a/.ruby-version b/.ruby-version
index 9cec7165a..f9892605c 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-3.1.6
+3.4.4
diff --git a/Dockerfile b/Dockerfile
index 281fd6ca2..88a7e6a79 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ruby:3.1.6-alpine3.20 as base
+FROM ruby:3.4.4-alpine3.20 as base
WORKDIR /app
@@ -10,7 +10,7 @@ RUN apk add --update --no-cache tzdata && \
# build-base: compilation tools for bundle
# yarn: node package manager
# postgresql-dev: postgres driver and libraries
-RUN apk add --no-cache build-base=0.5-r3 busybox=1.36.1-r29 nodejs=20.15.1-r0 yarn=1.22.22-r0 bash=5.2.26-r0 libpq-dev
+RUN apk add --no-cache build-base=0.5-r3 busybox=1.36.1-r29 nodejs=20.15.1-r0 yarn=1.22.22-r0 bash=5.2.26-r0 libpq-dev yaml-dev linux-headers
# Bundler version should be the same version as what the Gemfile.lock was bundled with
RUN gem install bundler:2.6.4 --no-document
diff --git a/Gemfile b/Gemfile
index f6e7fdac5..91ed6c8a8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
-ruby "3.1.6"
+ruby "3.4.4"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem "rails", "~> 7.2.2"
@@ -51,7 +51,7 @@ gem "paper_trail-globalid"
gem "pundit"
# Request rate limiting
-gem "rack", ">= 2.2.6.3"
+gem "rack", "~> 3.1.20"
gem "rack-attack"
gem "redis", "~> 4.8"
# Receive exceptions and configure alerts
@@ -72,9 +72,12 @@ gem "sidekiq-cron"
gem "unread"
# Pinning versions to address vulnerabilities
-gem "nokogiri", "~> 1.18.9"
+gem "nokogiri", "~> 1.19.1"
gem "thor", "~> 1.4.0"
+# Pinning until activesupport is updated to v8.1.2
+gem "connection_pool", "~> 2.5"
+
group :development, :test do
# Check gems for known vulnerabilities
gem "bundler-audit"
@@ -95,7 +98,7 @@ group :development do
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem "erb_lint", require: false
gem "rack-mini-profiler", "~> 3.3.0"
- gem "rubocop-govuk", "4.3.0", require: false
+ gem "rubocop-govuk", "5.2.0", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 34bfd3067..4277b9499 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -78,7 +78,7 @@ GEM
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
- ast (2.4.2)
+ ast (2.4.3)
auto_strip_attributes (2.6.0)
activerecord (>= 4.0)
aws-eventstream (1.4.0)
@@ -113,15 +113,15 @@ GEM
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.3.0)
bcrypt (3.1.20)
- benchmark (0.4.1)
- better_html (2.0.2)
- actionview (>= 6.0)
- activesupport (>= 6.0)
+ benchmark (0.5.0)
+ better_html (2.2.0)
+ actionview (>= 7.0)
+ activesupport (>= 7.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
- bigdecimal (3.2.2)
+ bigdecimal (4.0.1)
bindex (0.8.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
@@ -151,7 +151,7 @@ GEM
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
- concurrent-ruby (1.3.5)
+ concurrent-ruby (1.3.6)
connection_pool (2.5.3)
crack (1.0.0)
bigdecimal
@@ -184,12 +184,12 @@ GEM
drb (2.2.3)
dumb_delegator (1.0.0)
encryptor (3.0.0)
- erb_lint (0.5.0)
+ erb_lint (0.9.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
- rubocop
+ rubocop (>= 1)
smart_properties
erubi (1.13.1)
et-orbi (1.2.11)
@@ -232,7 +232,7 @@ GEM
hashdiff (1.1.0)
html-attributes-utils (1.0.2)
activesupport (>= 6.1.4.4)
- i18n (1.14.7)
+ i18n (1.14.8)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
iniparse (1.5.0)
@@ -261,13 +261,15 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
+ language_server-protocol (3.17.0.5)
launchy (2.5.2)
addressable (~> 2.8)
+ lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
- loofah (2.24.0)
+ loofah (2.25.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
@@ -279,7 +281,9 @@ GEM
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
- minitest (5.25.5)
+ minitest (6.0.2)
+ drb (~> 2.0)
+ prism (~> 1.5)
msgpack (1.7.2)
multipart-post (2.4.1)
nested_form (0.3.2)
@@ -295,13 +299,13 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
- nokogiri (1.18.9-arm64-darwin)
+ nokogiri (1.19.1-arm64-darwin)
racc (~> 1.4)
- nokogiri (1.18.9-x86_64-darwin)
+ nokogiri (1.19.1-x86_64-darwin)
racc (~> 1.4)
- nokogiri (1.18.9-x86_64-linux-gnu)
+ nokogiri (1.19.1-x86_64-linux-gnu)
racc (~> 1.4)
- nokogiri (1.18.9-x86_64-linux-musl)
+ nokogiri (1.19.1-x86_64-linux-musl)
racc (~> 1.4)
notifications-ruby-client (6.0.0)
jwt (>= 1.5, < 3)
@@ -317,10 +321,10 @@ GEM
paper_trail-globalid (0.2.0)
globalid
paper_trail (>= 3.0.0)
- parallel (1.24.0)
+ parallel (1.27.0)
parallel_tests (4.5.1)
parallel
- parser (3.3.0.5)
+ parser (3.3.10.2)
ast (~> 2.4.1)
racc
pg (1.5.5)
@@ -328,6 +332,7 @@ GEM
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
+ prism (1.9.0)
propshaft (0.8.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
@@ -349,7 +354,7 @@ GEM
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.8.1)
- rack (3.1.18)
+ rack (3.1.20)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-mini-profiler (3.3.1)
@@ -375,7 +380,7 @@ GEM
activesupport (= 7.2.2.2)
bundler (>= 1.15.0)
railties (= 7.2.2.2)
- rails-dom-testing (2.2.0)
+ rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
@@ -409,7 +414,7 @@ GEM
redis (4.8.1)
redis-client (0.22.1)
connection_pool
- regexp_parser (2.9.0)
+ regexp_parser (2.11.3)
reline (0.6.0)
io-console (~> 0.5)
request_store (1.7.0)
@@ -439,34 +444,45 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.13.1)
- rubocop (1.25.0)
+ rubocop (1.82.1)
+ json (~> 2.3)
+ language_server-protocol (~> 3.17.0.2)
+ lint_roller (~> 1.1.0)
parallel (~> 1.10)
- parser (>= 3.1.0.0)
+ parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
- regexp_parser (>= 1.8, < 3.0)
- rexml
- rubocop-ast (>= 1.15.1, < 2.0)
+ regexp_parser (>= 2.9.3, < 3.0)
+ rubocop-ast (>= 1.48.0, < 2.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.15.1)
- parser (>= 3.0.1.1)
- rubocop-govuk (4.3.0)
- rubocop (= 1.25.0)
- rubocop-ast (= 1.15.1)
- rubocop-rails (= 2.13.2)
- rubocop-rake (= 0.6.0)
- rubocop-rspec (= 2.7.0)
+ unicode-display_width (>= 2.4.0, < 4.0)
+ rubocop-ast (1.49.0)
+ parser (>= 3.3.7.2)
+ prism (~> 1.7)
+ rubocop-capybara (2.22.1)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.72, >= 1.72.1)
+ rubocop-govuk (5.2.0)
+ rubocop (= 1.82.1)
+ rubocop-ast (= 1.49.0)
+ rubocop-capybara (= 2.22.1)
+ rubocop-rails (= 2.34.3)
+ rubocop-rake (= 0.7.1)
+ rubocop-rspec (= 3.9.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
- rubocop-rails (2.13.2)
+ rubocop-rails (2.34.3)
activesupport (>= 4.2.0)
+ lint_roller (~> 1.1)
rack (>= 1.1)
- rubocop (>= 1.7.0, < 2.0)
- rubocop-rake (0.6.0)
- rubocop (~> 1.0)
- rubocop-rspec (2.7.0)
- rubocop (~> 1.19)
+ rubocop (>= 1.75.0, < 2.0)
+ rubocop-ast (>= 1.44.0, < 2.0)
+ rubocop-rake (0.7.1)
+ lint_roller (~> 1.1)
+ rubocop (>= 1.72.1)
+ rubocop-rspec (3.9.0)
+ lint_roller (~> 1.1)
+ rubocop (~> 1.81)
ruby-openai (7.0.1)
event_stream_parser (>= 0.3.0, < 2.0.0)
faraday (>= 1)
@@ -514,7 +530,9 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uk_postcode (2.1.8)
- unicode-display_width (2.5.0)
+ unicode-display_width (3.2.0)
+ unicode-emoji (~> 4.1)
+ unicode-emoji (4.2.0)
unread (0.14.0)
activerecord (>= 6.1)
uri (1.0.4)
@@ -563,6 +581,7 @@ DEPENDENCIES
capybara
capybara-lockstep
capybara-screenshot
+ connection_pool (~> 2.5)
cssbundling-rails
devise
devise_two_factor_authentication
@@ -579,7 +598,7 @@ DEPENDENCIES
json-schema
listen (~> 3.3)
method_source (~> 1.1)
- nokogiri (~> 1.18.9)
+ nokogiri (~> 1.19.1)
notifications-ruby-client
overcommit (>= 0.37.0)
paper_trail (~> 15.2)
@@ -591,7 +610,7 @@ DEPENDENCIES
pry-byebug
puma (~> 6.4)
pundit
- rack (>= 2.2.6.3)
+ rack (~> 3.1.20)
rack-attack
rack-mini-profiler (~> 3.3.0)
rails (~> 7.2.2)
@@ -600,7 +619,7 @@ DEPENDENCIES
redis (~> 4.8)
roo
rspec-rails
- rubocop-govuk (= 4.3.0)
+ rubocop-govuk (= 5.2.0)
rubocop-performance
rubocop-rails
ruby-openai
@@ -621,7 +640,7 @@ DEPENDENCIES
webmock
RUBY VERSION
- ruby 3.1.6p260
+ ruby 3.4.4p0
BUNDLED WITH
2.6.4
diff --git a/app/components/create_log_actions_component.html.erb b/app/components/create_log_actions_component.html.erb
index 3eab0f871..130072ec0 100644
--- a/app/components/create_log_actions_component.html.erb
+++ b/app/components/create_log_actions_component.html.erb
@@ -14,17 +14,33 @@
These tools can only be seen and used in testing environments.
<%= govuk_button_link_to create_test_log_href, class: "govuk-button" do %>
- New test log
+ New <%= current_collection_year_label %> test log
<% end %>
+ <% if FeatureToggle.allow_future_form_use? %>
+ <%= govuk_button_link_to create_next_year_test_log_href, class: "govuk-button" do %>
+ New <%= next_collection_year_label %> test log
+
+
+
+ <% end %>
+ <% end %>
<%= govuk_button_link_to create_setup_test_log_href, class: "govuk-button" do %>
- New test log (setup only)
+ New <%= current_collection_year_label %> test log (setup only)
<% end %>
+ <% if FeatureToggle.allow_future_form_use? %>
+ <%= govuk_button_link_to create_next_year_setup_test_log_href, class: "govuk-button" do %>
+ New <%= next_collection_year_label %> test log (setup only)
+
+
+
+ <% end %>
+ <% end %>
<%= govuk_button_link_to create_test_bulk_upload_href(2025), class: "govuk-button govuk-button--secondary" do %>
25/26 BU test file
diff --git a/app/components/create_log_actions_component.rb b/app/components/create_log_actions_component.rb
index ae240bc91..c618c01fc 100644
--- a/app/components/create_log_actions_component.rb
+++ b/app/components/create_log_actions_component.rb
@@ -1,5 +1,6 @@
class CreateLogActionsComponent < ViewComponent::Base
include Rails.application.routes.url_helpers
+ include CollectionTimeHelper
attr_reader :bulk_upload, :user, :log_type
@@ -38,10 +39,26 @@ class CreateLogActionsComponent < ViewComponent::Base
send("create_test_#{log_type}_log_path")
end
+ def create_next_year_test_log_href
+ send("create_next_year_test_#{log_type}_log_path")
+ end
+
def create_setup_test_log_href
send("create_setup_test_#{log_type}_log_path")
end
+ def create_next_year_setup_test_log_href
+ send("create_next_year_setup_test_#{log_type}_log_path")
+ end
+
+ def current_collection_year_label
+ "#{current_collection_start_year - 2000}/#{current_collection_end_year - 2000}"
+ end
+
+ def next_collection_year_label
+ "#{next_collection_start_year - 2000}/#{next_collection_end_year - 2000}"
+ end
+
def create_test_bulk_upload_href(year)
send("create_#{year}_test_#{log_type}_bulk_upload_path")
end
diff --git a/app/controllers/csv_downloads_controller.rb b/app/controllers/csv_downloads_controller.rb
index 25f70026f..e2a7fb4f1 100644
--- a/app/controllers/csv_downloads_controller.rb
+++ b/app/controllers/csv_downloads_controller.rb
@@ -5,7 +5,7 @@ class CsvDownloadsController < ApplicationController
@csv_download = CsvDownload.find(params[:id])
authorize @csv_download
- return render "errors/download_link_expired" if @csv_download.expired?
+ render "errors/download_link_expired" if @csv_download.expired?
end
def download
diff --git a/app/controllers/lettings_logs_controller.rb b/app/controllers/lettings_logs_controller.rb
index 38a89b682..cd2a6ca5a 100644
--- a/app/controllers/lettings_logs_controller.rb
+++ b/app/controllers/lettings_logs_controller.rb
@@ -190,7 +190,7 @@ private
end
def resolve_logs!
- if @log&.unresolved && @log.location.present? && @log.scheme.present? && @log&.resolve!
+ if @log&.unresolved && @log.location.present? && @log.scheme.present? && @log.resolve!
unresolved_logs_count_for_user = current_user.lettings_logs.unresolved.assigned_to(current_user).count
flash.now[:notice] = helpers.flash_notice_for_resolved_logs(unresolved_logs_count_for_user)
end
diff --git a/app/controllers/lettings_logs_filters_controller.rb b/app/controllers/lettings_logs_filters_controller.rb
index 9180737d3..c6ea0ba70 100644
--- a/app/controllers/lettings_logs_filters_controller.rb
+++ b/app/controllers/lettings_logs_filters_controller.rb
@@ -52,8 +52,6 @@ class LettingsLogsFiltersController < ApplicationController
end
end
-private
-
def lettings_session_filters
params["years"] = [params["years"]] if params["years"].present?
lettings_filter_manager.session_filters
diff --git a/app/controllers/merge_requests_controller.rb b/app/controllers/merge_requests_controller.rb
index 32f7b2d0c..f1878e9ab 100644
--- a/app/controllers/merge_requests_controller.rb
+++ b/app/controllers/merge_requests_controller.rb
@@ -105,7 +105,7 @@ private
answer_options = { "" => "Select an option" }
if current_user.support?
- Organisation.all.each do |organisation|
+ Organisation.all.find_each do |organisation|
date = @merge_request.merge_date || Time.zone.today
answer_options[organisation.id] = organisation.name(date:)
end
diff --git a/app/controllers/sales_logs_filters_controller.rb b/app/controllers/sales_logs_filters_controller.rb
index ffa4f4bc4..70a4c2b49 100644
--- a/app/controllers/sales_logs_filters_controller.rb
+++ b/app/controllers/sales_logs_filters_controller.rb
@@ -53,8 +53,6 @@ class SalesLogsFiltersController < ApplicationController
end
end
-private
-
def sales_session_filters
params["years"] = [params["years"]] if params["years"].present?
sales_filter_manager.session_filters
diff --git a/app/controllers/test_data_controller.rb b/app/controllers/test_data_controller.rb
index d9315d68c..5298a4fc7 100644
--- a/app/controllers/test_data_controller.rb
+++ b/app/controllers/test_data_controller.rb
@@ -10,6 +10,13 @@ class TestDataController < ApplicationController
redirect_to lettings_log_path(log)
end
+ def create_next_year_test_lettings_log
+ return render_not_found unless FeatureToggle.create_test_logs_enabled?
+
+ log = FactoryBot.create(:lettings_log, :completed, assigned_to: current_user, ppostcode_full: "SW1A 1AA", manual_address_entry_selected: false, startdate: generate_different_date_within_collection_year(Time.zone.local(next_collection_start_year, 4, 1)))
+ redirect_to lettings_log_path(log)
+ end
+
def create_setup_test_lettings_log
return render_not_found unless FeatureToggle.create_test_logs_enabled?
@@ -17,6 +24,13 @@ class TestDataController < ApplicationController
redirect_to lettings_log_path(log)
end
+ def create_next_year_setup_test_lettings_log
+ return render_not_found unless FeatureToggle.create_test_logs_enabled?
+
+ log = FactoryBot.create(:lettings_log, :setup_completed, assigned_to: current_user, manual_address_entry_selected: false, startdate: generate_different_date_within_collection_year(Time.zone.local(next_collection_start_year, 4, 1)))
+ redirect_to lettings_log_path(log)
+ end
+
%w[2025 2026].each do |year|
define_method("create_#{year}_test_lettings_bulk_upload") do
return render_not_found unless FeatureToggle.create_test_logs_enabled?
@@ -47,6 +61,13 @@ class TestDataController < ApplicationController
redirect_to sales_log_path(log)
end
+ def create_next_year_test_sales_log
+ return render_not_found unless FeatureToggle.create_test_logs_enabled?
+
+ log = FactoryBot.create(:sales_log, :completed, assigned_to: current_user, manual_address_entry_selected: false, saledate: generate_different_date_within_collection_year(Time.zone.local(next_collection_start_year, 4, 1)))
+ redirect_to sales_log_path(log)
+ end
+
def create_setup_test_sales_log
return render_not_found unless FeatureToggle.create_test_logs_enabled?
@@ -54,6 +75,13 @@ class TestDataController < ApplicationController
redirect_to sales_log_path(log)
end
+ def create_next_year_setup_test_sales_log
+ return render_not_found unless FeatureToggle.create_test_logs_enabled?
+
+ log = FactoryBot.create(:sales_log, :shared_ownership_setup_complete, assigned_to: current_user, manual_address_entry_selected: false, saledate: generate_different_date_within_collection_year(Time.zone.local(next_collection_start_year, 4, 1)))
+ redirect_to sales_log_path(log)
+ end
+
%w[2025 2026].each do |year|
define_method("create_#{year}_test_sales_bulk_upload") do
return render_not_found unless FeatureToggle.create_test_logs_enabled?
diff --git a/app/helpers/bulk_upload/lettings_log_to_csv.rb b/app/helpers/bulk_upload/lettings_log_to_csv.rb
index c483f4754..11f60773f 100644
--- a/app/helpers/bulk_upload/lettings_log_to_csv.rb
+++ b/app/helpers/bulk_upload/lettings_log_to_csv.rb
@@ -2,12 +2,10 @@ class BulkUpload::LettingsLogToCsv
attr_reader :log, :line_ending, :col_offset, :overrides
def initialize(log:, line_ending: "\n", col_offset: 1, overrides: {})
- # rubocop:disable Rails/HelperInstanceVariable
@log = log
@line_ending = line_ending
@col_offset = col_offset
@overrides = overrides
- # rubocop:enable Rails/HelperInstanceVariable
end
def row_prefix
@@ -107,8 +105,8 @@ class BulkUpload::LettingsLogToCsv
renewal,
log.startdate&.day,
log.startdate&.month,
- log.startdate&.strftime("%y"), # 10
+ log.startdate&.strftime("%y"), # 10
rent_type,
log.irproduct_other,
log.tenancycode,
@@ -118,20 +116,19 @@ class BulkUpload::LettingsLogToCsv
log.unitletas,
log.uprn,
log.address_line1&.tr(",", " "),
- log.address_line2&.tr(",", " "), # 20
+ log.address_line2&.tr(",", " "), # 20
log.town_or_city&.tr(",", " "),
log.county&.tr(",", " "),
((log.postcode_full || "").split(" ") || [""]).first,
((log.postcode_full || "").split(" ") || [""]).last,
log.la,
log.unittype_gn,
- log.builtype,
log.wchair,
log.beds,
- log.voiddate&.day, # 30
+ log.voiddate&.day,
- log.voiddate&.month,
+ log.voiddate&.month, # 30
log.voiddate&.strftime("%y"),
log.mrcdate&.day,
log.mrcdate&.month,
@@ -140,98 +137,119 @@ class BulkUpload::LettingsLogToCsv
log.joint,
log.startertenancy,
log.tenancy,
- log.tenancyother, # 40
+ log.tenancyother,
- log.tenancylength,
+ log.tenancylength, # 40
log.age1 || overrides[:age1],
- log.sex1,
+ log.sexrab1,
+ log.gender_same_as_sex1,
+ log.gender_description1,
log.ethnic,
log.nationality_all_group,
log.ecstat1,
- relat_number(log.relat2),
log.age2 || overrides[:age2],
- log.sex2,
- log.ecstat2, # 50
+ relat_number(log.relat2),
- relat_number(log.relat3),
+ log.sexrab2, # 50
+ log.gender_same_as_sex2,
+ log.gender_description2,
+ log.ecstat2,
log.age3 || overrides[:age3],
- log.sex3,
+ relat_number(log.relat3),
+ log.sexrab3,
+ log.gender_same_as_sex3,
+ log.gender_description3,
log.ecstat3,
+
+ log.age4 || overrides[:age4], # 60
relat_number(log.relat4),
- log.age4 || overrides[:age4],
- log.sex4,
+ log.sexrab4,
+ log.gender_same_as_sex4,
+ log.gender_description4,
log.ecstat4,
+ log.age5 || overrides[:age5],
relat_number(log.relat5),
- log.age5 || overrides[:age5], # 60
+ log.sexrab5,
+ log.gender_same_as_sex5,
- log.sex5,
+ log.gender_description5, # 70
log.ecstat5,
- relat_number(log.relat6),
log.age6 || overrides[:age6],
- log.sex6,
+ relat_number(log.relat6),
+ log.sexrab6,
+ log.gender_same_as_sex6,
+ log.gender_description6,
log.ecstat6,
- relat_number(log.relat7),
log.age7 || overrides[:age7],
- log.sex7,
- log.ecstat7, # 70
+ relat_number(log.relat7),
- relat_number(log.relat8),
+ log.sexrab7, # 80
+ log.gender_same_as_sex7,
+ log.gender_description7,
+ log.ecstat7,
log.age8 || overrides[:age8],
- log.sex8,
+ relat_number(log.relat8),
+ log.sexrab8,
+ log.gender_same_as_sex8,
+ log.gender_description8,
log.ecstat8,
- log.armedforces,
+
+ log.armedforces, # 90
log.leftreg,
log.reservist,
log.preg_occ,
log.housingneeds_a,
- log.housingneeds_b, # 80
-
+ log.housingneeds_b,
log.housingneeds_c,
log.housingneeds_f,
log.housingneeds_g,
log.housingneeds_h,
- overrides[:illness] || log.illness,
+
+ overrides[:illness] || log.illness, # 100
log.illness_type_1,
log.illness_type_2,
log.illness_type_3,
log.illness_type_4,
- log.illness_type_5, # 90
-
+ log.illness_type_5,
log.illness_type_6,
log.illness_type_7,
log.illness_type_8,
log.illness_type_9,
- log.illness_type_10,
+
+ log.illness_type_10, # 110
log.layear,
log.waityear,
log.reason,
log.reasonother,
- log.prevten, # 100
-
+ log.prevten,
homeless,
previous_postcode_known,
((log.ppostcode_full || "").split(" ") || [""]).first,
((log.ppostcode_full || "").split(" ") || [""]).last,
- log.prevloc,
+
+ log.prevloc, # 120
log.reasonpref,
log.rp_homeless,
log.rp_insan_unsat,
log.rp_medwel,
- log.rp_hardship, # 110
-
+ log.rp_hardship,
log.rp_dontknow,
cbl,
chr,
cap,
- accessible_register,
- log.referral,
+
+ accessible_register, # 130
+ log.owning_organisation.la? ? log.referral_register : nil,
+ log.owning_organisation.prp? ? log.referral_register : nil,
+ log.referral_noms,
+ log.referral_org,
net_income_known,
log.incfreq,
log.earnings,
- log.hb, # 120
-
+ log.hb,
log.benefits,
- log.household_charge,
+
+ log.household_charge, # 140
log.period,
log.brent,
log.scharge,
@@ -239,31 +257,6 @@ class BulkUpload::LettingsLogToCsv
log.supcharg,
log.hbrentshortfall,
log.tshortfall,
-
- log.sexrab1, # 130
- log.sexrab2,
- log.sexrab3,
- log.sexrab4,
- log.sexrab5,
- log.sexrab6,
- log.sexrab7,
- log.sexrab8,
- log.gender_same_as_sex1,
- log.gender_description1,
- log.gender_same_as_sex2, # 140
- log.gender_description2,
- log.gender_same_as_sex3,
- log.gender_description3,
- log.gender_same_as_sex4,
- log.gender_description4,
- log.gender_same_as_sex5,
- log.gender_description5,
- log.gender_same_as_sex6,
- log.gender_description6,
- log.gender_same_as_sex7, # 150
- log.gender_description7,
- log.gender_same_as_sex8,
- log.gender_description8, # 153
]
end
diff --git a/app/helpers/bulk_upload/sales_log_to_csv.rb b/app/helpers/bulk_upload/sales_log_to_csv.rb
index 1171f481f..30833c1c7 100644
--- a/app/helpers/bulk_upload/sales_log_to_csv.rb
+++ b/app/helpers/bulk_upload/sales_log_to_csv.rb
@@ -2,12 +2,10 @@ class BulkUpload::SalesLogToCsv
attr_reader :log, :line_ending, :col_offset, :overrides
def initialize(log:, line_ending: "\n", col_offset: 1, overrides: {})
- # rubocop:disable Rails/HelperInstanceVariable
@log = log
@line_ending = line_ending
@col_offset = col_offset
@overrides = overrides
- # rubocop:enable Rails/HelperInstanceVariable
end
def row_prefix
diff --git a/app/helpers/collection_time_helper.rb b/app/helpers/collection_time_helper.rb
index ad7dac6a9..1e8c0eef4 100644
--- a/app/helpers/collection_time_helper.rb
+++ b/app/helpers/collection_time_helper.rb
@@ -16,10 +16,13 @@ module CollectionTimeHelper
Time.zone.local(collection_start_year_for_date(date), 4, 1)
end
- def date_mid_collection_year_formatted(date)
+ def date_mid_collection_year(date)
relevant_year = date.nil? ? current_collection_start_year : collection_start_year_for_date(date)
- example_date = Date.new(relevant_year, 9, 13)
- example_date.to_formatted_s(:govuk_date_number_month)
+ Date.new(relevant_year, 9, 13)
+ end
+
+ def date_mid_collection_year_formatted(date)
+ date_mid_collection_year(date).to_formatted_s(:govuk_date_number_month)
end
def current_collection_start_date
diff --git a/app/helpers/data_sharing_agreement_helper.rb b/app/helpers/data_sharing_agreement_helper.rb
index 79296e6dc..5ab5e3272 100644
--- a/app/helpers/data_sharing_agreement_helper.rb
+++ b/app/helpers/data_sharing_agreement_helper.rb
@@ -67,7 +67,7 @@ module DataSharingAgreementHelper
"12.2. For #{@org_name}: Name: #{@dpo_name}, Postal Address: #{@org_address}, E-mail address: #{@dpo_email}, Telephone number: #{@org_phone}"
end
end
-# rubocop:enable Rails/HelperInstanceVariable
+ # rubocop:enable Rails/HelperInstanceVariable
private
diff --git a/app/helpers/form_page_error_helper.rb b/app/helpers/form_page_error_helper.rb
index ded09d54c..c2ce87310 100644
--- a/app/helpers/form_page_error_helper.rb
+++ b/app/helpers/form_page_error_helper.rb
@@ -5,7 +5,7 @@ module FormPageErrorHelper
end
def remove_duplicate_page_errors(lettings_log)
- lettings_log.errors.group_by(&:message).each do |_, errors|
+ lettings_log.errors.group_by(&:message).each_value do |errors|
next if errors.size == 1
errors.shift
diff --git a/app/helpers/form_page_helper.rb b/app/helpers/form_page_helper.rb
index 74e75e572..98b9bb8d5 100644
--- a/app/helpers/form_page_helper.rb
+++ b/app/helpers/form_page_helper.rb
@@ -1,4 +1,6 @@
module FormPageHelper
+ include CollectionTimeHelper
+
def action_href(log, page_id, referrer = "check_answers")
send("#{log.log_type}_#{page_id}_path", log, referrer:)
end
@@ -46,4 +48,11 @@ module FormPageHelper
page.skip_href(log) || send(log.form.next_page_redirect_path(page, log, current_user, ignore_answered: true), log)
end
end
+
+ def date_hint(question, log)
+ [
+ question.hint_text.presence,
+ question.date_example_override(log) || "For example, #{date_mid_collection_year_formatted(log.startdate).tr(' ', '/')}",
+ ].compact.join(" ").html_safe
+ end
end
diff --git a/app/helpers/locations_helper.rb b/app/helpers/locations_helper.rb
index 9ef74ca51..b8a111b0c 100644
--- a/app/helpers/locations_helper.rb
+++ b/app/helpers/locations_helper.rb
@@ -91,7 +91,8 @@ module LocationsHelper
def toggle_location_link(location)
return govuk_button_link_to "Deactivate this location", scheme_location_new_deactivation_path(location.scheme, location), warning: true if location.active? || location.deactivates_in_a_long_time?
- return govuk_button_link_to "Reactivate this location", scheme_location_new_reactivation_path(location.scheme, location) if location.deactivated? && !location.deactivated_by_scheme?
+
+ govuk_button_link_to "Reactivate this location", scheme_location_new_reactivation_path(location.scheme, location) if location.deactivated? && !location.deactivated_by_scheme?
end
def delete_location_link(location)
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb
index 3d9577ce9..6755b4646 100644
--- a/app/helpers/merge_requests_helper.rb
+++ b/app/helpers/merge_requests_helper.rb
@@ -101,13 +101,13 @@ module MergeRequestsHelper
attribute = page if attribute.nil?
return nil unless value_exists?(merge_request, attribute)
- unless merge_request.status == "request_merged" || merge_request.status == "processing"
+ unless %w[request_merged processing].include?(merge_request.status)
{ text: merge_request_action_text(merge_request, attribute), href: send("#{page}_merge_request_path", merge_request, referrer: "check_answers"), visually_hidden_text: page.humanize }
end
end
def merge_outcome_action(merge_request, page)
- unless merge_request.status == "request_merged" || merge_request.status == "processing"
+ unless %w[request_merged processing].include?(merge_request.status)
{ text: "View", href: send("#{page}_merge_request_path", merge_request), visually_hidden_text: page.humanize }
end
end
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index 318918134..d3a369b45 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -57,7 +57,7 @@ class NotificationRenderer < Redcarpet::Render::HTML
def initialize(options = {})
link_class = "govuk-link"
link_class += " govuk-link--inverse" if options[:invert_link_colour]
- @bold = options[:bold_all_text] # rubocop:disable Rails/HelperInstanceVariable
+ @bold = options[:bold_all_text]
base_options = { escape_html: true, safe_links_only: true, link_attributes: { class: link_class } }
super base_options
end
@@ -78,7 +78,7 @@ class NotificationRenderer < Redcarpet::Render::HTML
end
def paragraph(text)
- return %(#{text}
) if @bold # rubocop:disable Rails/HelperInstanceVariable
+ return %(#{text}
) if @bold
%(#{text}
)
end
diff --git a/app/helpers/question_view_helper.rb b/app/helpers/question_view_helper.rb
index acb4fa959..0c4b6337f 100644
--- a/app/helpers/question_view_helper.rb
+++ b/app/helpers/question_view_helper.rb
@@ -44,7 +44,8 @@ module QuestionViewHelper
def select_option_name(value)
return value.service_name if value.respond_to?(:service_name)
return value["name"] if value.is_a?(Hash) && value["name"].present?
- return value["postcode"] if value.is_a?(Location)
+
+ value["postcode"] if value.is_a?(Location)
end
private
diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb
index 753f33917..e72250c6e 100644
--- a/app/helpers/schemes_helper.rb
+++ b/app/helpers/schemes_helper.rb
@@ -12,7 +12,8 @@ module SchemesHelper
def toggle_scheme_link(scheme)
return govuk_button_link_to "Deactivate this scheme", scheme_new_deactivation_path(scheme), warning: true if scheme.active? || scheme.deactivates_in_a_long_time?
- return govuk_button_link_to "Reactivate this scheme", scheme_new_reactivation_path(scheme) if scheme.deactivated? || scheme.deactivating_soon?
+
+ govuk_button_link_to "Reactivate this scheme", scheme_new_reactivation_path(scheme) if scheme.deactivated? || scheme.deactivating_soon?
end
def delete_scheme_link(scheme)
diff --git a/app/mailers/devise_notify_mailer.rb b/app/mailers/devise_notify_mailer.rb
index 5ee3fd898..4065e3aa9 100644
--- a/app/mailers/devise_notify_mailer.rb
+++ b/app/mailers/devise_notify_mailer.rb
@@ -92,8 +92,7 @@ class DeviseNotifyMailer < Devise::Mailer
def email_changed?(record)
(
- record.confirmable_template == User::CONFIRMABLE_TEMPLATE_ID && (
- record.unconfirmed_email.present? && record.unconfirmed_email != record.email)
+ record.confirmable_template == User::CONFIRMABLE_TEMPLATE_ID && record.unconfirmed_email.present? && record.unconfirmed_email != record.email
) || (
record.versions.last.changeset.key?("unconfirmed_email") &&
record.confirmed?
diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb
index eb01e459a..6c88c3221 100644
--- a/app/models/derived_variables/lettings_log_variables.rb
+++ b/app/models/derived_variables/lettings_log_variables.rb
@@ -33,7 +33,7 @@ module DerivedVariables::LettingsLogVariables
def set_derived_fields!
clear_inapplicable_derived_values!
- set_encoded_derived_values!(DEPENDENCIES)
+ set_encoded_derived_values!(dependencies)
if rsnvac.present?
self.newprop = has_first_let_vacancy_reason? ? 1 : 2
@@ -184,20 +184,15 @@ module DerivedVariables::LettingsLogVariables
private
- DEPENDENCIES = [
- {
- conditions: {
- renewal: 1,
- },
- derived_values: {
- referral: 1,
- referral_type: 3,
- waityear: 2,
- offered: 0,
- rsnvac: 14,
- first_time_property_let_as_social_housing: 0,
- },
- },
+ def dependencies
+ if form.start_year_2026_or_later?
+ DEPENDENCIES_2026
+ else
+ DEPENDENCIES_2025_2024
+ end
+ end
+
+ COMMON_DEPENDENCIES = [
{
conditions: {
net_income_known: 2,
@@ -224,9 +219,42 @@ private
},
].freeze
+ DEPENDENCIES_2026 = [
+ {
+ conditions: {
+ renewal: 1,
+ },
+ derived_values: {
+ referral_register: 1,
+ waityear: 2,
+ offered: 0,
+ rsnvac: 14,
+ first_time_property_let_as_social_housing: 0,
+ },
+ },
+ *COMMON_DEPENDENCIES,
+ ].freeze
+
+ DEPENDENCIES_2025_2024 = [
+ {
+ conditions: {
+ renewal: 1,
+ },
+ derived_values: {
+ referral: 1,
+ referral_type: 3,
+ waityear: 2,
+ offered: 0,
+ rsnvac: 14,
+ first_time_property_let_as_social_housing: 0,
+ },
+ },
+ *COMMON_DEPENDENCIES,
+ ].freeze
+
def clear_inapplicable_derived_values!
- reset_invalidated_derived_values!(DEPENDENCIES)
- if (startdate_changed? || renewal_changed?) && (renewal_was == 1 && startdate_was&.between?(Time.zone.local(2021, 4, 1), Time.zone.local(2022, 3, 31)))
+ reset_invalidated_derived_values!(dependencies)
+ if (startdate_changed? || renewal_changed?) && renewal_was == 1 && startdate_was&.between?(Time.zone.local(2021, 4, 1), Time.zone.local(2022, 3, 31))
self.underoccupation_benefitcap = nil
end
if renewal_changed? && renewal_was == 1
@@ -242,7 +270,7 @@ private
self.wchair = nil
self.location_id = nil
end
- if form.start_year_2024_or_later? && (unittype_gn_changed? && unittype_gn_was == 2)
+ if form.start_year_2024_or_later? && unittype_gn_changed? && unittype_gn_was == 2
self.beds = nil
end
end
@@ -272,7 +300,7 @@ private
end
def get_refused
- return 1 if details_unknown? || age_refused? || sex_refused? || relat_refused? || ecstat_refused?
+ return 1 if details_unknown? || age_refused? || sex_refused? || sexrab_refused? || relat_refused? || ecstat_refused?
0
end
@@ -411,13 +439,15 @@ private
def get_lar
return 1 if rent_type == 2
- return 2 if rent_type == 1
+
+ 2 if rent_type == 1
end
def get_irproduct
return 1 if rent_type == 3
return 2 if rent_type == 4
- return 3 if rent_type == 5
+
+ 3 if rent_type == 5
end
def clear_gender_description_unless_gender_not_same_as_sex!
diff --git a/app/models/derived_variables/shared_logic.rb b/app/models/derived_variables/shared_logic.rb
index c326cb8c9..4b76d83d8 100644
--- a/app/models/derived_variables/shared_logic.rb
+++ b/app/models/derived_variables/shared_logic.rb
@@ -9,7 +9,7 @@ private
previously_in_derived_state = dependency[:conditions].all? { |attribute, value| send("#{attribute}_was") == value }
next unless previously_in_derived_state
- dependency[:derived_values].each do |derived_attribute, _derived_value|
+ dependency[:derived_values].each_key do |derived_attribute|
Rails.logger.debug("Cleared derived #{derived_attribute} value")
send("#{derived_attribute}=", nil)
end
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb
index 5b06d6a28..24f836d04 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_age_value_check.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadAgeValu
super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_lead_age_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
- @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
+ @depends_on = [{ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true }]
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [],
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb
index 3e961b283..c786afe56 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembV
super(id, hsh, subsection)
@id = "females_in_soft_age_range_in_pregnant_household_lead_hhmemb_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
- @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
+ @depends_on = [{ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true }]
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [],
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb
index af568b039..bb3670c74 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_lead_value_check.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadValueCh
super
@id = "females_in_soft_age_range_in_pregnant_household_lead_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
- @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
+ @depends_on = [{ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true }]
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [],
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb
index ddc8789f9..cfd035ac3 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_age_value_check.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeVa
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
@depends_on = [
{
- "female_in_pregnant_household_in_soft_validation_range?" => true,
+ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true,
"age#{person_index}_known" => 0,
},
]
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb
index 099bea5d9..de1fb5fc9 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_person_value_check.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValue
@depends_on = [
{
- "female_in_pregnant_household_in_soft_validation_range?" => true,
+ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true,
"details_known_#{person_index}" => 0,
},
]
diff --git a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb
index 3822ec940..66603753e 100644
--- a/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb
+++ b/app/models/form/lettings/pages/females_in_soft_age_range_in_pregnant_household_value_check.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdValueCheck
super
@id = "females_in_soft_age_range_in_pregnant_household_value_check"
@copy_key = "lettings.soft_validations.pregnancy_value_check.females_in_soft_age_range_in_pregnant_household_value_check"
- @depends_on = [{ "female_in_pregnant_household_in_soft_validation_range?" => true }]
+ @depends_on = [{ "non_males_in_pregnant_household_not_in_pregnancy_range?" => true }]
@title_text = {
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
"arguments" => [],
diff --git a/app/models/form/lettings/pages/no_household_member_likely_to_be_pregnant_check.rb b/app/models/form/lettings/pages/no_household_member_likely_to_be_pregnant_check.rb
new file mode 100644
index 000000000..cefb98ceb
--- /dev/null
+++ b/app/models/form/lettings/pages/no_household_member_likely_to_be_pregnant_check.rb
@@ -0,0 +1,24 @@
+class Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck < ::Form::Page
+ def initialize(id, hsh, subsection, person_index: 0)
+ super(id, hsh, subsection)
+ @copy_key = "lettings.soft_validations.pregnancy_value_check.no_household_member_likely_to_be_pregnant_check"
+ @depends_on = [{ "no_household_member_likely_to_be_pregnant?" => true }]
+ @title_text = {
+ "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
+ "arguments" => [],
+ }
+ @informative_text = {
+ "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
+ "arguments" => [],
+ }
+ @person_index = person_index
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self, person_index: @person_index)]
+ end
+
+ def interruption_screen_question_ids
+ %w[preg_occ age1 sexrab1 gender_same_as_sex1 age2 sexrab2 gender_same_as_sex2 age3 sexrab3 gender_same_as_sex3 age4 sexrab4 gender_same_as_sex4 age5 sexrab5 gender_same_as_sex5 age6 sexrab6 gender_same_as_sex6 age7 sexrab7 gender_same_as_sex7 age8 sexrab8 gender_same_as_sex8]
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_direct.rb b/app/models/form/lettings/pages/referral_direct.rb
index df05aa997..79a8d4044 100644
--- a/app/models/form/lettings/pages/referral_direct.rb
+++ b/app/models/form/lettings/pages/referral_direct.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralDirect < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_general_needs.rb b/app/models/form/lettings/pages/referral_general_needs.rb
index 5522d1f23..a55ed5553 100644
--- a/app/models/form/lettings/pages/referral_general_needs.rb
+++ b/app/models/form/lettings/pages/referral_general_needs.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Pages::ReferralGeneralNeeds < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_general_needs_prp.rb b/app/models/form/lettings/pages/referral_general_needs_prp.rb
index e3206ebdb..99e033ab6 100644
--- a/app/models/form/lettings/pages/referral_general_needs_prp.rb
+++ b/app/models/form/lettings/pages/referral_general_needs_prp.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Pages::ReferralGeneralNeedsPrp < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_hsc.rb b/app/models/form/lettings/pages/referral_hsc.rb
index 596852947..c7c16ba58 100644
--- a/app/models/form/lettings/pages/referral_hsc.rb
+++ b/app/models/form/lettings/pages/referral_hsc.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralHsc < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_justice.rb b/app/models/form/lettings/pages/referral_justice.rb
index fa10bb727..564f9f98c 100644
--- a/app/models/form/lettings/pages/referral_justice.rb
+++ b/app/models/form/lettings/pages/referral_justice.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralJustice < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_la.rb b/app/models/form/lettings/pages/referral_la.rb
index 3f04f3aaf..5e3adbf62 100644
--- a/app/models/form/lettings/pages/referral_la.rb
+++ b/app/models/form/lettings/pages/referral_la.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralLa < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_noms_hr.rb b/app/models/form/lettings/pages/referral_noms_hr.rb
new file mode 100644
index 000000000..d1120bffd
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_noms_hr.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralNomsHr < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_noms_hr"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralNoms.new(nil, nil, self, 7)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_from_housing_register?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_noms_la_hr.rb b/app/models/form/lettings/pages/referral_noms_la_hr.rb
new file mode 100644
index 000000000..cc0e27371
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_noms_la_hr.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralNomsLaHr < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_noms_la_hr"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralNoms.new(nil, nil, self, 6)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_from_local_authority_housing_register?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_org_directly_referred.rb b/app/models/form/lettings/pages/referral_org_directly_referred.rb
new file mode 100644
index 000000000..baf4c2747
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_org_directly_referred.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralOrgDirectlyReferred < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_org_directly_referred"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralOrg.new(nil, nil, self, 7)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_directly_referred?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_org_nominated.rb b/app/models/form/lettings/pages/referral_org_nominated.rb
new file mode 100644
index 000000000..8be5f8edc
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_org_nominated.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralOrgNominated < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_org_nominated"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralOrg.new(nil, nil, self, 1)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_nominated_by_local_authority?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_prp.rb b/app/models/form/lettings/pages/referral_prp.rb
index 8d25edc44..492941e52 100644
--- a/app/models/form/lettings/pages/referral_prp.rb
+++ b/app/models/form/lettings/pages/referral_prp.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralPrp < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_register_la.rb b/app/models/form/lettings/pages/referral_register_la.rb
new file mode 100644
index 000000000..ee570f1cb
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_register_la.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralRegisterLa < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_register_la"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralRegister.new(nil, nil, self, :la)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.la? && !log.is_renewal?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_register_prp.rb b/app/models/form/lettings/pages/referral_register_prp.rb
new file mode 100644
index 000000000..d0c5cdaf1
--- /dev/null
+++ b/app/models/form/lettings/pages/referral_register_prp.rb
@@ -0,0 +1,15 @@
+# added in 2026
+class Form::Lettings::Pages::ReferralRegisterPrp < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "referral_register_prp"
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::ReferralRegister.new(nil, nil, self, :prp)]
+ end
+
+ def routed_to?(log, _current_user)
+ log.owning_organisation&.prp? && !log.is_renewal?
+ end
+end
diff --git a/app/models/form/lettings/pages/referral_supported_housing.rb b/app/models/form/lettings/pages/referral_supported_housing.rb
index a3e915e26..b20a0a825 100644
--- a/app/models/form/lettings/pages/referral_supported_housing.rb
+++ b/app/models/form/lettings/pages/referral_supported_housing.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Pages::ReferralSupportedHousing < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_supported_housing_prp.rb b/app/models/form/lettings/pages/referral_supported_housing_prp.rb
index 66b6f370e..0f546b400 100644
--- a/app/models/form/lettings/pages/referral_supported_housing_prp.rb
+++ b/app/models/form/lettings/pages/referral_supported_housing_prp.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Pages::ReferralSupportedHousingPrp < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_type.rb b/app/models/form/lettings/pages/referral_type.rb
index 3cca2ca2b..08b19d14c 100644
--- a/app/models/form/lettings/pages/referral_type.rb
+++ b/app/models/form/lettings/pages/referral_type.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Pages::ReferralType < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/referral_value_check.rb b/app/models/form/lettings/pages/referral_value_check.rb
index aa3a34200..265ba5312 100644
--- a/app/models/form/lettings/pages/referral_value_check.rb
+++ b/app/models/form/lettings/pages/referral_value_check.rb
@@ -1,3 +1,4 @@
+# removed in 2026
class Form::Lettings::Pages::ReferralValueCheck < ::Form::Page
def initialize(id, hsh, subsection)
super
diff --git a/app/models/form/lettings/pages/tenancyother_value_check.rb b/app/models/form/lettings/pages/tenancyother_value_check.rb
new file mode 100644
index 000000000..391b06eab
--- /dev/null
+++ b/app/models/form/lettings/pages/tenancyother_value_check.rb
@@ -0,0 +1,24 @@
+class Form::Lettings::Pages::TenancyotherValueCheck < ::Form::Page
+ def initialize(id, hsh, subsection)
+ super
+ @id = "tenancyother_value_check"
+ @copy_key = "lettings.soft_validations.tenancyother_value_check"
+ @depends_on = [{ "tenancyother_might_be_introductory_or_starter_period?" => true }]
+ @title_text = {
+ "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text",
+ "arguments" => [{ "key" => "tenancyother", "i18n_template" => "tenancyother" }],
+ }
+ @informative_text = {
+ "translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
+ "arguments" => [],
+ }
+ end
+
+ def questions
+ @questions ||= [Form::Lettings::Questions::TenancyotherValueCheck.new(nil, nil, self)]
+ end
+
+ def interruption_screen_question_ids
+ %w[startertenancy tenancy tenancyother]
+ end
+end
diff --git a/app/models/form/lettings/questions/address_line1.rb b/app/models/form/lettings/questions/address_line1.rb
index 4b1f67931..2f88b210e 100644
--- a/app/models/form/lettings/questions/address_line1.rb
+++ b/app/models/form/lettings/questions/address_line1.rb
@@ -7,7 +7,7 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question
@type = "text"
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@hide_question_number_on_page = true
end
@@ -18,5 +18,5 @@ class Form::Lettings::Questions::AddressLine1 < ::Form::Question
].select(&:present?).join("\n")
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17, 2026 => 17 }.freeze
end
diff --git a/app/models/form/lettings/questions/address_search.rb b/app/models/form/lettings/questions/address_search.rb
index c6abe9a6c..eb970a5e5 100644
--- a/app/models/form/lettings/questions/address_search.rb
+++ b/app/models/form/lettings/questions/address_search.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::AddressSearch < ::Form::Question
@copy_key = "lettings.property_information.address_search"
@plain_label = true
@bottom_guidance_partial = "address_search"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@hide_question_number_on_page = true
end
@@ -38,5 +38,5 @@ class Form::Lettings::Questions::AddressSearch < ::Form::Question
answer_options(log, user).transform_values { |value| value["value"] } || {}
end
- QUESTION_NUMBER_FROM_YEAR = { 2024 => 12, 2025 => 16 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2024 => 12, 2025 => 16, 2026 => 16 }.freeze
end
diff --git a/app/models/form/lettings/questions/age.rb b/app/models/form/lettings/questions/age.rb
index f35abe61e..61e70fe05 100644
--- a/app/models/form/lettings/questions/age.rb
+++ b/app/models/form/lettings/questions/age.rb
@@ -19,11 +19,17 @@ class Form::Lettings::Questions::Age < ::Form::Question
base_question_number = case form.start_date.year
when 2023
31
- else
+ when 2024
+ 30
+ when 2025
30
+ when 2026
+ 27
+ else
+ 27
end
- base_question_number + (4 * @person_index)
+ base_question_number + (form.person_question_count * @person_index)
end
def hint_text
diff --git a/app/models/form/lettings/questions/age1.rb b/app/models/form/lettings/questions/age1.rb
index 72d89096c..428fabd42 100644
--- a/app/models/form/lettings/questions/age1.rb
+++ b/app/models/form/lettings/questions/age1.rb
@@ -10,8 +10,8 @@ class Form::Lettings::Questions::Age1 < ::Form::Question
@max = 120
@min = 16
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31, 2025 => 31, 2026 => 30 }.freeze
end
diff --git a/app/models/form/lettings/questions/age1_known.rb b/app/models/form/lettings/questions/age1_known.rb
index e54d7993b..753fdd2cb 100644
--- a/app/models/form/lettings/questions/age1_known.rb
+++ b/app/models/form/lettings/questions/age1_known.rb
@@ -8,10 +8,10 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
@answer_options = ANSWER_OPTIONS
@conditional_for = { "age1" => [0] }
@hidden_in_check_answers = { "depends_on" => [{ "age1_known" => 0 }, { "age1_known" => 1 }] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 32, 2024 => 31, 2025 => 31, 2026 => 30 }.freeze
end
diff --git a/app/models/form/lettings/questions/age_known.rb b/app/models/form/lettings/questions/age_known.rb
index 2f5d7ce0b..c4bb65c2e 100644
--- a/app/models/form/lettings/questions/age_known.rb
+++ b/app/models/form/lettings/questions/age_known.rb
@@ -23,10 +23,16 @@ class Form::Lettings::Questions::AgeKnown < ::Form::Question
base_question_number = case form.start_date.year
when 2023
31
- else
+ when 2024
+ 30
+ when 2025
30
+ when 2026
+ 27
+ else
+ 27
end
- base_question_number + (4 * @person_index)
+ base_question_number + (form.person_question_count * @person_index)
end
end
diff --git a/app/models/form/lettings/questions/armedforces.rb b/app/models/form/lettings/questions/armedforces.rb
index 9bfe4b643..32aac69ca 100644
--- a/app/models/form/lettings/questions/armedforces.rb
+++ b/app/models/form/lettings/questions/armedforces.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Armedforces < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -18,5 +18,5 @@ class Form::Lettings::Questions::Armedforces < ::Form::Question
"6" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 66, 2024 => 65 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 66, 2024 => 65, 2025 => 65, 2026 => 72 }.freeze
end
diff --git a/app/models/form/lettings/questions/beds.rb b/app/models/form/lettings/questions/beds.rb
index 1bafa3ddf..1e59c367c 100644
--- a/app/models/form/lettings/questions/beds.rb
+++ b/app/models/form/lettings/questions/beds.rb
@@ -7,12 +7,12 @@ class Form::Lettings::Questions::Beds < ::Form::Question
@max = 12
@min = 1
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def derived?(log)
log.is_bedsit?
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 22 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 22, 2024 => 22, 2025 => 22, 2026 => 21 }.freeze
end
diff --git a/app/models/form/lettings/questions/benefits.rb b/app/models/form/lettings/questions/benefits.rb
index f5f2a3ee1..4ab922215 100644
--- a/app/models/form/lettings/questions/benefits.rb
+++ b/app/models/form/lettings/questions/benefits.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Benefits < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -16,5 +16,5 @@ class Form::Lettings::Questions::Benefits < ::Form::Question
"4" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 90, 2024 => 89 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 90, 2024 => 89, 2025 => 89, 2026 => 97 }.freeze
end
diff --git a/app/models/form/lettings/questions/brent_4_weekly.rb b/app/models/form/lettings/questions/brent_4_weekly.rb
index 7087571fd..319b495a5 100644
--- a/app/models/form/lettings/questions/brent_4_weekly.rb
+++ b/app/models/form/lettings/questions/brent_4_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::Brent4Weekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 4 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92, 2026 => 100 }.freeze
end
diff --git a/app/models/form/lettings/questions/brent_bi_weekly.rb b/app/models/form/lettings/questions/brent_bi_weekly.rb
index 1a20fd61c..d33863756 100644
--- a/app/models/form/lettings/questions/brent_bi_weekly.rb
+++ b/app/models/form/lettings/questions/brent_bi_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::BrentBiWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 2 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92, 2026 => 100 }.freeze
end
diff --git a/app/models/form/lettings/questions/brent_monthly.rb b/app/models/form/lettings/questions/brent_monthly.rb
index 245bde158..8e71bb8ec 100644
--- a/app/models/form/lettings/questions/brent_monthly.rb
+++ b/app/models/form/lettings/questions/brent_monthly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::BrentMonthly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every month"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92, 2026 => 100 }.freeze
end
diff --git a/app/models/form/lettings/questions/brent_weekly.rb b/app/models/form/lettings/questions/brent_weekly.rb
index c913816fc..706f94b3d 100644
--- a/app/models/form/lettings/questions/brent_weekly.rb
+++ b/app/models/form/lettings/questions/brent_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::BrentWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every week"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 95, 2024 => 94, 2025 => 92, 2026 => 100 }.freeze
end
diff --git a/app/models/form/lettings/questions/builtype.rb b/app/models/form/lettings/questions/builtype.rb
index 8c34beca1..55f76536c 100644
--- a/app/models/form/lettings/questions/builtype.rb
+++ b/app/models/form/lettings/questions/builtype.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::Builtype < ::Form::Question
@id = "builtype"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -12,5 +12,5 @@ class Form::Lettings::Questions::Builtype < ::Form::Question
"1" => { "value" => "Purpose built" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 20 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 20, 2024 => 20, 2025 => 20 }.freeze
end
diff --git a/app/models/form/lettings/questions/chcharge_4_weekly.rb b/app/models/form/lettings/questions/chcharge_4_weekly.rb
index 341010eb0..403ab3e75 100644
--- a/app/models/form/lettings/questions/chcharge_4_weekly.rb
+++ b/app/models/form/lettings/questions/chcharge_4_weekly.rb
@@ -9,9 +9,9 @@ class Form::Lettings::Questions::Chcharge4Weekly < ::Form::Question
@step = 0.01
@prefix = "£"
@suffix = " every 4 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/chcharge_bi_weekly.rb b/app/models/form/lettings/questions/chcharge_bi_weekly.rb
index 0343839ca..274b26d0d 100644
--- a/app/models/form/lettings/questions/chcharge_bi_weekly.rb
+++ b/app/models/form/lettings/questions/chcharge_bi_weekly.rb
@@ -9,9 +9,9 @@ class Form::Lettings::Questions::ChchargeBiWeekly < ::Form::Question
@step = 0.01
@prefix = "£"
@suffix = " every 2 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/chcharge_monthly.rb b/app/models/form/lettings/questions/chcharge_monthly.rb
index 9e68eb18f..967295d45 100644
--- a/app/models/form/lettings/questions/chcharge_monthly.rb
+++ b/app/models/form/lettings/questions/chcharge_monthly.rb
@@ -9,9 +9,9 @@ class Form::Lettings::Questions::ChchargeMonthly < ::Form::Question
@step = 0.01
@prefix = "£"
@suffix = " every month"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/chcharge_weekly.rb b/app/models/form/lettings/questions/chcharge_weekly.rb
index 3c8b995eb..d27d586b4 100644
--- a/app/models/form/lettings/questions/chcharge_weekly.rb
+++ b/app/models/form/lettings/questions/chcharge_weekly.rb
@@ -9,9 +9,9 @@ class Form::Lettings::Questions::ChchargeWeekly < ::Form::Question
@step = 0.01
@prefix = "£"
@suffix = " every week"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 94, 2024 => 93, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/condition_effects.rb b/app/models/form/lettings/questions/condition_effects.rb
index 1821f6e98..af967d17e 100644
--- a/app/models/form/lettings/questions/condition_effects.rb
+++ b/app/models/form/lettings/questions/condition_effects.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::ConditionEffects < ::Form::Question
@type = "checkbox"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -27,5 +27,5 @@ class Form::Lettings::Questions::ConditionEffects < ::Form::Question
"illness_type_10" => { "value" => "Other" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 74, 2024 => 73 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 74, 2024 => 73, 2025 => 73, 2026 => 80 }.freeze
end
diff --git a/app/models/form/lettings/questions/county.rb b/app/models/form/lettings/questions/county.rb
index 12585fa8e..b634fd6dc 100644
--- a/app/models/form/lettings/questions/county.rb
+++ b/app/models/form/lettings/questions/county.rb
@@ -6,9 +6,9 @@ class Form::Lettings::Questions::County < ::Form::Question
@type = "text"
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@hide_question_number_on_page = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17, 2026 => 17 }.freeze
end
diff --git a/app/models/form/lettings/questions/declaration.rb b/app/models/form/lettings/questions/declaration.rb
index 3261452cd..6a2572487 100644
--- a/app/models/form/lettings/questions/declaration.rb
+++ b/app/models/form/lettings/questions/declaration.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Declaration < ::Form::Question
@type = "checkbox"
@check_answers_card_number = 0 unless form.start_year_2024_or_later?
@top_guidance_partial = "privacy_notice_tenant"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -26,5 +26,5 @@ class Form::Lettings::Questions::Declaration < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 30, 2024 => 11 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 30, 2024 => 11, 2025 => 11, 2026 => 11 }.freeze
end
diff --git a/app/models/form/lettings/questions/earnings.rb b/app/models/form/lettings/questions/earnings.rb
index 4d3437052..13482135e 100644
--- a/app/models/form/lettings/questions/earnings.rb
+++ b/app/models/form/lettings/questions/earnings.rb
@@ -15,9 +15,9 @@ class Form::Lettings::Questions::Earnings < ::Form::Question
{ "label" => " every month", "depends_on" => { "incfreq" => 2 } },
{ "label" => " every year", "depends_on" => { "incfreq" => 3 } },
]
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 88, 2024 => 87 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 88, 2024 => 87, 2025 => 87, 2026 => 95 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_arab.rb b/app/models/form/lettings/questions/ethnic_arab.rb
index d642c1a1b..582d92704 100644
--- a/app/models/form/lettings/questions/ethnic_arab.rb
+++ b/app/models/form/lettings/questions/ethnic_arab.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::EthnicArab < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -18,5 +18,5 @@ class Form::Lettings::Questions::EthnicArab < ::Form::Question
},
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34, 2025 => 34, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_asian.rb b/app/models/form/lettings/questions/ethnic_asian.rb
index 7fb309bba..f488249a6 100644
--- a/app/models/form/lettings/questions/ethnic_asian.rb
+++ b/app/models/form/lettings/questions/ethnic_asian.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::EthnicAsian < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -27,5 +27,5 @@ class Form::Lettings::Questions::EthnicAsian < ::Form::Question
},
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34, 2025 => 34, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_black.rb b/app/models/form/lettings/questions/ethnic_black.rb
index e3a88259e..f6902eb35 100644
--- a/app/models/form/lettings/questions/ethnic_black.rb
+++ b/app/models/form/lettings/questions/ethnic_black.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::EthnicBlack < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -21,5 +21,5 @@ class Form::Lettings::Questions::EthnicBlack < ::Form::Question
},
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34, 2025 => 34, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_group.rb b/app/models/form/lettings/questions/ethnic_group.rb
index 16bdfc4ba..c1c0be096 100644
--- a/app/models/form/lettings/questions/ethnic_group.rb
+++ b/app/models/form/lettings/questions/ethnic_group.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::EthnicGroup < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -18,5 +18,5 @@ class Form::Lettings::Questions::EthnicGroup < ::Form::Question
"17" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 34, 2024 => 33 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 34, 2024 => 33, 2025 => 33, 2026 => 33 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_mixed.rb b/app/models/form/lettings/questions/ethnic_mixed.rb
index 14d1f213b..f12f997b6 100644
--- a/app/models/form/lettings/questions/ethnic_mixed.rb
+++ b/app/models/form/lettings/questions/ethnic_mixed.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::EthnicMixed < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -24,5 +24,5 @@ class Form::Lettings::Questions::EthnicMixed < ::Form::Question
},
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34, 2025 => 34, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/ethnic_white.rb b/app/models/form/lettings/questions/ethnic_white.rb
index 74430d840..98ebe78f3 100644
--- a/app/models/form/lettings/questions/ethnic_white.rb
+++ b/app/models/form/lettings/questions/ethnic_white.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::EthnicWhite < ::Form::Question
@copy_key = "lettings.household_characteristics.ethnic.ethnic_background_white"
@type = "radio"
@check_answers_card_number = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -27,5 +27,5 @@ class Form::Lettings::Questions::EthnicWhite < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 35, 2024 => 34, 2025 => 34, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb b/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb
index 09e6ece30..c9fb77abf 100644
--- a/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb
+++ b/app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing < ::Form::Q
super
@id = "first_time_property_let_as_social_housing"
@type = "radio"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -21,5 +21,5 @@ class Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing < ::Form::Q
form.start_year_2024_or_later? ? "This is a re-let of existing social housing stock." : "This is a re-let of existing social housing."
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 14, 2024 => 15, 2025 => 12 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 14, 2024 => 15, 2025 => 12, 2026 => 12 }.freeze
end
diff --git a/app/models/form/lettings/questions/gender_identity1.rb b/app/models/form/lettings/questions/gender_identity1.rb
index 411bcd3d0..f3d86fde0 100644
--- a/app/models/form/lettings/questions/gender_identity1.rb
+++ b/app/models/form/lettings/questions/gender_identity1.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::GenderIdentity1 < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -16,5 +16,5 @@ class Form::Lettings::Questions::GenderIdentity1 < ::Form::Question
"R" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 33, 2024 => 32 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 33, 2024 => 32, 2025 => 32 }.freeze
end
diff --git a/app/models/form/lettings/questions/gender_same_as_sex.rb b/app/models/form/lettings/questions/gender_same_as_sex.rb
index 1fdfddda5..0b0fd55b5 100644
--- a/app/models/form/lettings/questions/gender_same_as_sex.rb
+++ b/app/models/form/lettings/questions/gender_same_as_sex.rb
@@ -7,6 +7,7 @@ class Form::Lettings::Questions::GenderSameAsSex < ::Form::Question
@conditional_for = { "gender_description#{person_index}" => [2] }
@person_index = person_index
@question_number = question_number
+ @inferred_check_answers_value = [{ "condition" => { "gender_same_as_sex#{person_index}" => 2 }, "value" => "No" }]
end
def answer_options
diff --git a/app/models/form/lettings/questions/hb.rb b/app/models/form/lettings/questions/hb.rb
index 51da058b8..f9204e65a 100644
--- a/app/models/form/lettings/questions/hb.rb
+++ b/app/models/form/lettings/questions/hb.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Hb < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -17,5 +17,5 @@ class Form::Lettings::Questions::Hb < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 89, 2024 => 88 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 89, 2024 => 88, 2025 => 88, 2026 => 96 }.freeze
end
diff --git a/app/models/form/lettings/questions/hbrentshortfall.rb b/app/models/form/lettings/questions/hbrentshortfall.rb
index 294423815..dfc323c3a 100644
--- a/app/models/form/lettings/questions/hbrentshortfall.rb
+++ b/app/models/form/lettings/questions/hbrentshortfall.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Hbrentshortfall < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Hbrentshortfall < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 99, 2024 => 98, 2025 => 96 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 99, 2024 => 98, 2025 => 96, 2026 => 104 }.freeze
end
diff --git a/app/models/form/lettings/questions/hhmemb.rb b/app/models/form/lettings/questions/hhmemb.rb
index 88328a869..614b2b27e 100644
--- a/app/models/form/lettings/questions/hhmemb.rb
+++ b/app/models/form/lettings/questions/hhmemb.rb
@@ -8,9 +8,9 @@ class Form::Lettings::Questions::Hhmemb < ::Form::Question
@max = 8
@min = 1
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@check_answers_card_title = "Household" if form.start_year_2026_or_later?
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 31, 2024 => 30 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 31, 2024 => 30, 2025 => 30, 2026 => 29 }.freeze
end
diff --git a/app/models/form/lettings/questions/homeless.rb b/app/models/form/lettings/questions/homeless.rb
index 1194fa929..44e03f937 100644
--- a/app/models/form/lettings/questions/homeless.rb
+++ b/app/models/form/lettings/questions/homeless.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Homeless < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -13,5 +13,5 @@ class Form::Lettings::Questions::Homeless < ::Form::Question
"1" => { "value" => "No" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 79, 2024 => 78 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 79, 2024 => 78, 2025 => 78, 2026 => 85 }.freeze
end
diff --git a/app/models/form/lettings/questions/household_charge.rb b/app/models/form/lettings/questions/household_charge.rb
index 60fee977d..32bdee4a6 100644
--- a/app/models/form/lettings/questions/household_charge.rb
+++ b/app/models/form/lettings/questions/household_charge.rb
@@ -5,10 +5,10 @@ class Form::Lettings::Questions::HouseholdCharge < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 91, 2024 => 90 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 91, 2024 => 90, 2025 => 90, 2026 => 98 }.freeze
end
diff --git a/app/models/form/lettings/questions/housingneeds.rb b/app/models/form/lettings/questions/housingneeds.rb
index 03c80d5cb..29f0b5882 100644
--- a/app/models/form/lettings/questions/housingneeds.rb
+++ b/app/models/form/lettings/questions/housingneeds.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Housingneeds < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Housingneeds < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 70, 2024 => 69 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 70, 2024 => 69, 2025 => 69, 2026 => 76 }.freeze
end
diff --git a/app/models/form/lettings/questions/housingneeds_other.rb b/app/models/form/lettings/questions/housingneeds_other.rb
index d99812535..d8915e936 100644
--- a/app/models/form/lettings/questions/housingneeds_other.rb
+++ b/app/models/form/lettings/questions/housingneeds_other.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::HousingneedsOther < ::Form::Question
@copy_key = "lettings.household_needs.housingneeds_type.housingneeds_other"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -24,5 +24,5 @@ class Form::Lettings::Questions::HousingneedsOther < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 72, 2024 => 71 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 72, 2024 => 71, 2025 => 71, 2026 => 78 }.freeze
end
diff --git a/app/models/form/lettings/questions/housingneeds_type.rb b/app/models/form/lettings/questions/housingneeds_type.rb
index 50b9c3742..15b5782d5 100644
--- a/app/models/form/lettings/questions/housingneeds_type.rb
+++ b/app/models/form/lettings/questions/housingneeds_type.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::HousingneedsType < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -17,5 +17,5 @@ class Form::Lettings::Questions::HousingneedsType < ::Form::Question
"3" => { "value" => "None of the listed options" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 71, 2024 => 70 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 71, 2024 => 70, 2025 => 70, 2026 => 77 }.freeze
end
diff --git a/app/models/form/lettings/questions/illness.rb b/app/models/form/lettings/questions/illness.rb
index f92a7a04a..4bc3667fb 100644
--- a/app/models/form/lettings/questions/illness.rb
+++ b/app/models/form/lettings/questions/illness.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Illness < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Illness < ::Form::Question
"3" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 73, 2024 => 72 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 73, 2024 => 72, 2025 => 72, 2026 => 79 }.freeze
end
diff --git a/app/models/form/lettings/questions/incfreq.rb b/app/models/form/lettings/questions/incfreq.rb
index d4384218e..74e24f439 100644
--- a/app/models/form/lettings/questions/incfreq.rb
+++ b/app/models/form/lettings/questions/incfreq.rb
@@ -7,7 +7,7 @@ class Form::Lettings::Questions::Incfreq < ::Form::Question
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = true
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -16,5 +16,5 @@ class Form::Lettings::Questions::Incfreq < ::Form::Question
"3" => { "value" => "Yearly" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 87, 2024 => 86 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 87, 2024 => 86, 2025 => 86, 2026 => 94 }.freeze
end
diff --git a/app/models/form/lettings/questions/irproduct_other.rb b/app/models/form/lettings/questions/irproduct_other.rb
index b004d5dc2..993fcbf54 100644
--- a/app/models/form/lettings/questions/irproduct_other.rb
+++ b/app/models/form/lettings/questions/irproduct_other.rb
@@ -4,8 +4,8 @@ class Form::Lettings::Questions::IrproductOther < ::Form::Question
@id = "irproduct_other"
@copy_key = "lettings.setup.rent_type.irproduct_other"
@type = "text"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 6, 2024 => 8 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 6, 2024 => 8, 2025 => 8, 2026 => 8 }.freeze
end
diff --git a/app/models/form/lettings/questions/is_carehome.rb b/app/models/form/lettings/questions/is_carehome.rb
index 25dae3fc6..ea2df6eac 100644
--- a/app/models/form/lettings/questions/is_carehome.rb
+++ b/app/models/form/lettings/questions/is_carehome.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@conditional_for = { "chcharge" => [1] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -23,5 +23,5 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 93, 2024 => 92 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 93, 2024 => 92, 2025 => 92, 2026 => 100 }.freeze
end
diff --git a/app/models/form/lettings/questions/joint.rb b/app/models/form/lettings/questions/joint.rb
index 2542cd1c7..11f6749a6 100644
--- a/app/models/form/lettings/questions/joint.rb
+++ b/app/models/form/lettings/questions/joint.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Joint < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Joint < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 25, 2024 => 25, 2025 => 26 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 25, 2024 => 25, 2025 => 26, 2026 => 25 }.freeze
end
diff --git a/app/models/form/lettings/questions/la.rb b/app/models/form/lettings/questions/la.rb
index c6d6f8240..d4d6954d2 100644
--- a/app/models/form/lettings/questions/la.rb
+++ b/app/models/form/lettings/questions/la.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::La < ::Form::Question
@type = "select"
@check_answers_card_number = nil
@hint_text = ""
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
@@ -13,5 +13,5 @@ class Form::Lettings::Questions::La < ::Form::Question
{ "" => "Select an option" }.merge(LocalAuthority.active(form.start_date).england.map { |la| [la.code, la.name] }.to_h)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 13, 2024 => 14, 2025 => 18 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 13, 2024 => 14, 2025 => 18, 2026 => 18 }.freeze
end
diff --git a/app/models/form/lettings/questions/layear.rb b/app/models/form/lettings/questions/layear.rb
index fdaad6c22..d8fa0a3a8 100644
--- a/app/models/form/lettings/questions/layear.rb
+++ b/app/models/form/lettings/questions/layear.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::Layear < ::Form::Question
@id = "layear"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -36,5 +36,5 @@ class Form::Lettings::Questions::Layear < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 75, 2024 => 74 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 75, 2024 => 74, 2025 => 74, 2026 => 81 }.freeze
end
diff --git a/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb b/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb
index 2e8523f51..7f07519d2 100644
--- a/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb
+++ b/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb
@@ -16,4 +16,12 @@ class Form::Lettings::Questions::LeadTenantSexRegisteredAtBirth < ::Form::Questi
}.freeze
QUESTION_NUMBER_FROM_YEAR = { 2026 => 31 }.freeze
+
+ def label_from_value(value, _log = nil, _user = nil)
+ return unless value
+
+ return "Prefers not to say" if value == "R"
+
+ super
+ end
end
diff --git a/app/models/form/lettings/questions/leftreg.rb b/app/models/form/lettings/questions/leftreg.rb
index 9b90566cf..3e81b52c0 100644
--- a/app/models/form/lettings/questions/leftreg.rb
+++ b/app/models/form/lettings/questions/leftreg.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Leftreg < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -16,5 +16,5 @@ class Form::Lettings::Questions::Leftreg < ::Form::Question
"3" => { "value" => "Person prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 67, 2024 => 66 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 67, 2024 => 66, 2025 => 66, 2026 => 73 }.freeze
end
diff --git a/app/models/form/lettings/questions/letting_allocation.rb b/app/models/form/lettings/questions/letting_allocation.rb
index 08310da13..2029335c4 100644
--- a/app/models/form/lettings/questions/letting_allocation.rb
+++ b/app/models/form/lettings/questions/letting_allocation.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question
@id = "letting_allocation"
@type = "checkbox"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -28,5 +28,5 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 84, 2024 => 83 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 84, 2024 => 83, 2025 => 83, 2026 => 90 }.freeze
end
diff --git a/app/models/form/lettings/questions/location_id.rb b/app/models/form/lettings/questions/location_id.rb
index 5bc316476..80e34aac0 100644
--- a/app/models/form/lettings/questions/location_id.rb
+++ b/app/models/form/lettings/questions/location_id.rb
@@ -10,7 +10,7 @@ class Form::Lettings::Questions::LocationId < ::Form::Question
"needstype": 2,
},
}
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@top_guidance_partial = "finding_location"
end
@@ -55,5 +55,5 @@ private
false
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 10, 2024 => 5 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 10, 2024 => 5, 2025 => 5, 2026 => 5 }.freeze
end
diff --git a/app/models/form/lettings/questions/location_id_search.rb b/app/models/form/lettings/questions/location_id_search.rb
index 5e1734b51..e64125fda 100644
--- a/app/models/form/lettings/questions/location_id_search.rb
+++ b/app/models/form/lettings/questions/location_id_search.rb
@@ -10,7 +10,7 @@ class Form::Lettings::Questions::LocationIdSearch < ::Form::Question
"needstype": 2,
},
}
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
@top_guidance_partial = "finding_location"
end
@@ -50,5 +50,5 @@ private
false
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 10, 2024 => 5 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 10, 2024 => 5, 2025 => 5, 2026 => 5 }.freeze
end
diff --git a/app/models/form/lettings/questions/majorrepairs.rb b/app/models/form/lettings/questions/majorrepairs.rb
index a0c8a3a5c..b9b740cb1 100644
--- a/app/models/form/lettings/questions/majorrepairs.rb
+++ b/app/models/form/lettings/questions/majorrepairs.rb
@@ -6,10 +6,10 @@ class Form::Lettings::Questions::Majorrepairs < ::Form::Question
@type = "radio"
@answer_options = ANSWER_OPTIONS
@conditional_for = { "mrcdate" => [1] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 24 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 24, 2024 => 24, 2025 => 24, 2026 => 23 }.freeze
end
diff --git a/app/models/form/lettings/questions/managing_organisation.rb b/app/models/form/lettings/questions/managing_organisation.rb
index 9c766ebe0..bf1b23c54 100644
--- a/app/models/form/lettings/questions/managing_organisation.rb
+++ b/app/models/form/lettings/questions/managing_organisation.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question
@id = "managing_organisation_id"
@derived = true
@type = "select"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
def answer_options(log = nil, user = nil)
@@ -83,5 +83,5 @@ private
true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 2 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 2, 2024 => 2, 2025 => 2, 2026 => 2 }.freeze
end
diff --git a/app/models/form/lettings/questions/mrcdate.rb b/app/models/form/lettings/questions/mrcdate.rb
index 0c311d186..33c511887 100644
--- a/app/models/form/lettings/questions/mrcdate.rb
+++ b/app/models/form/lettings/questions/mrcdate.rb
@@ -4,8 +4,8 @@ class Form::Lettings::Questions::Mrcdate < ::Form::Question
@id = "mrcdate"
@copy_key = "lettings.property_information.property_major_repairs.mrcdate"
@type = "date"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 24 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 24, 2024 => 24, 2025 => 24, 2026 => 23 }.freeze
end
diff --git a/app/models/form/lettings/questions/nationality.rb b/app/models/form/lettings/questions/nationality.rb
index 8c4a700c1..a966f68f7 100644
--- a/app/models/form/lettings/questions/nationality.rb
+++ b/app/models/form/lettings/questions/nationality.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Nationality < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -19,5 +19,5 @@ class Form::Lettings::Questions::Nationality < ::Form::Question
"13" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35, 2025 => 35, 2026 => 34 }.freeze
end
diff --git a/app/models/form/lettings/questions/nationality_all.rb b/app/models/form/lettings/questions/nationality_all.rb
index a4bb750a1..368c0ffb5 100644
--- a/app/models/form/lettings/questions/nationality_all.rb
+++ b/app/models/form/lettings/questions/nationality_all.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::NationalityAll < ::Form::Question
@type = "select"
@check_answers_card_number = 1
@answer_options = GlobalConstants::COUNTRIES_ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_label(log, _current_user = nil)
@@ -17,7 +17,7 @@ class Form::Lettings::Questions::NationalityAll < ::Form::Question
@answer_options.reject { |key, _| key == "826" }
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35, 2025 => 35, 2026 => 35 }.freeze
def label_from_value(value)
return unless value
diff --git a/app/models/form/lettings/questions/nationality_all_group.rb b/app/models/form/lettings/questions/nationality_all_group.rb
index 559b1c9a0..0c4ed5d90 100644
--- a/app/models/form/lettings/questions/nationality_all_group.rb
+++ b/app/models/form/lettings/questions/nationality_all_group.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::NationalityAllGroup < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@conditional_for = { "nationality_all" => [12] }
@hidden_in_check_answers = { "depends_on" => [{ "nationality_all_group" => 12 }] }
end
@@ -17,5 +17,5 @@ class Form::Lettings::Questions::NationalityAllGroup < ::Form::Question
"0" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 36, 2024 => 35, 2025 => 35, 2026 => 35 }.freeze
end
diff --git a/app/models/form/lettings/questions/needs_type.rb b/app/models/form/lettings/questions/needs_type.rb
index 9c32e30f9..87f331c07 100644
--- a/app/models/form/lettings/questions/needs_type.rb
+++ b/app/models/form/lettings/questions/needs_type.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::NeedsType < ::Form::Question
@id = "needstype"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
@top_guidance_partial = "needs_type" if form.start_year_2026_or_later?
end
@@ -13,5 +13,5 @@ class Form::Lettings::Questions::NeedsType < ::Form::Question
"2" => { "value" => "Supported housing" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 3 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 3, 2024 => 3, 2025 => 3, 2026 => 3 }.freeze
end
diff --git a/app/models/form/lettings/questions/net_income_known.rb b/app/models/form/lettings/questions/net_income_known.rb
index 01c3bcaa3..4bcbe7fd1 100644
--- a/app/models/form/lettings/questions/net_income_known.rb
+++ b/app/models/form/lettings/questions/net_income_known.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question
@check_answers_card_number = 0
@top_guidance_partial = "what_counts_as_income"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -16,5 +16,5 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question
"2" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 86, 2024 => 85 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 86, 2024 => 85, 2025 => 85, 2026 => 93 }.freeze
end
diff --git a/app/models/form/lettings/questions/offered.rb b/app/models/form/lettings/questions/offered.rb
index c1aae8d32..38eccb40d 100644
--- a/app/models/form/lettings/questions/offered.rb
+++ b/app/models/form/lettings/questions/offered.rb
@@ -8,8 +8,8 @@ class Form::Lettings::Questions::Offered < ::Form::Question
@max = 150
@min = 0
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 18 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 18, 2024 => 18, 2025 => 18, 2026 => 18 }.freeze
end
diff --git a/app/models/form/lettings/questions/period.rb b/app/models/form/lettings/questions/period.rb
index 6f98bd2a8..a0fb51d9f 100644
--- a/app/models/form/lettings/questions/period.rb
+++ b/app/models/form/lettings/questions/period.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Period < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -22,7 +22,7 @@ class Form::Lettings::Questions::Period < ::Form::Question
"10" => { "value" => "Weekly for 53 weeks" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 92, 2024 => 91 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 92, 2024 => 91, 2025 => 91, 2026 => 99 }.freeze
def displayed_answer_options(log, _user)
return ANSWER_OPTIONS if log.managing_organisation.nil?
diff --git a/app/models/form/lettings/questions/person_partner.rb b/app/models/form/lettings/questions/person_partner.rb
index 98a22a448..c7b673131 100644
--- a/app/models/form/lettings/questions/person_partner.rb
+++ b/app/models/form/lettings/questions/person_partner.rb
@@ -21,11 +21,17 @@ class Form::Lettings::Questions::PersonPartner < ::Form::Question
base_question_number = case form.start_date.year
when 2023
30
- else
+ when 2024
+ 29
+ when 2025
29
+ when 2026
+ 28
+ else
+ 28
end
- base_question_number + (4 * @person_index)
+ base_question_number + (form.person_question_count * @person_index)
end
def derived?(log)
diff --git a/app/models/form/lettings/questions/person_sex_registered_at_birth.rb b/app/models/form/lettings/questions/person_sex_registered_at_birth.rb
index b549885b1..819cc2df1 100644
--- a/app/models/form/lettings/questions/person_sex_registered_at_birth.rb
+++ b/app/models/form/lettings/questions/person_sex_registered_at_birth.rb
@@ -18,6 +18,14 @@ class Form::Lettings::Questions::PersonSexRegisteredAtBirth < ::Form::Question
def question_number
base_question_number = 29
- base_question_number + (5 * @person_index)
+ base_question_number + (form.person_question_count * @person_index)
+ end
+
+ def label_from_value(value, _log = nil, _user = nil)
+ return unless value
+
+ return "Prefers not to say" if value == "R"
+
+ super
end
end
diff --git a/app/models/form/lettings/questions/person_working_situation.rb b/app/models/form/lettings/questions/person_working_situation.rb
index 74e11d030..0089416fb 100644
--- a/app/models/form/lettings/questions/person_working_situation.rb
+++ b/app/models/form/lettings/questions/person_working_situation.rb
@@ -57,10 +57,16 @@ class Form::Lettings::Questions::PersonWorkingSituation < ::Form::Question
base_question_number = case form.start_date.year
when 2023
33
- else
+ when 2024
+ 32
+ when 2025
32
+ when 2026
+ 31
+ else
+ 31
end
- base_question_number + (4 * @person_index)
+ base_question_number + (form.person_question_count * @person_index)
end
end
diff --git a/app/models/form/lettings/questions/postcode_for_full_address.rb b/app/models/form/lettings/questions/postcode_for_full_address.rb
index 114cf0db5..84c93f7d7 100644
--- a/app/models/form/lettings/questions/postcode_for_full_address.rb
+++ b/app/models/form/lettings/questions/postcode_for_full_address.rb
@@ -18,10 +18,10 @@ class Form::Lettings::Questions::PostcodeForFullAddress < ::Form::Question
}
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@hide_question_number_on_page = true
@bottom_guidance_partial = "address_fallback"
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17, 2026 => 17 }.freeze
end
diff --git a/app/models/form/lettings/questions/ppcodenk.rb b/app/models/form/lettings/questions/ppcodenk.rb
index 5eec607eb..7cf7c63c2 100644
--- a/app/models/form/lettings/questions/ppcodenk.rb
+++ b/app/models/form/lettings/questions/ppcodenk.rb
@@ -8,7 +8,7 @@ class Form::Lettings::Questions::Ppcodenk < ::Form::Question
@answer_options = ANSWER_OPTIONS
@conditional_for = { "ppostcode_full" => [0] }
@hidden_in_check_answers = { "depends_on" => [{ "ppcodenk" => 0 }, { "ppcodenk" => 1 }] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
@@ -17,5 +17,5 @@ class Form::Lettings::Questions::Ppcodenk < ::Form::Question
"1" => { "value" => "No" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 80, 2024 => 79 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 80, 2024 => 79, 2025 => 79, 2026 => 86 }.freeze
end
diff --git a/app/models/form/lettings/questions/ppostcode_full.rb b/app/models/form/lettings/questions/ppostcode_full.rb
index 804576ca1..41feded8f 100644
--- a/app/models/form/lettings/questions/ppostcode_full.rb
+++ b/app/models/form/lettings/questions/ppostcode_full.rb
@@ -13,9 +13,9 @@ class Form::Lettings::Questions::PpostcodeFull < ::Form::Question
}]
@check_answers_card_number = 0
@inferred_answers = { "prevloc" => { "is_previous_la_inferred" => true } }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 80, 2024 => 79 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 80, 2024 => 79, 2025 => 79, 2026 => 86 }.freeze
end
diff --git a/app/models/form/lettings/questions/preg_occ.rb b/app/models/form/lettings/questions/preg_occ.rb
index 1ad1bd1f5..03bae1c04 100644
--- a/app/models/form/lettings/questions/preg_occ.rb
+++ b/app/models/form/lettings/questions/preg_occ.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::PregOcc < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::PregOcc < ::Form::Question
"3" => { "value" => "Tenant prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 69, 2024 => 68 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 69, 2024 => 68, 2025 => 68, 2026 => 75 }.freeze
end
diff --git a/app/models/form/lettings/questions/previous_la_known.rb b/app/models/form/lettings/questions/previous_la_known.rb
index 2145e9d1f..b8721ff46 100644
--- a/app/models/form/lettings/questions/previous_la_known.rb
+++ b/app/models/form/lettings/questions/previous_la_known.rb
@@ -8,11 +8,11 @@ class Form::Lettings::Questions::PreviousLaKnown < ::Form::Question
@answer_options = ANSWER_OPTIONS
@conditional_for = { "prevloc" => [1] }
@hidden_in_check_answers = { "depends_on" => [{ "previous_la_known" => 0 }, { "previous_la_known" => 1 }] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 81, 2024 => 80 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 81, 2024 => 80, 2025 => 80, 2026 => 87 }.freeze
end
diff --git a/app/models/form/lettings/questions/previous_let_type.rb b/app/models/form/lettings/questions/previous_let_type.rb
index 8c35df84c..660e42869 100644
--- a/app/models/form/lettings/questions/previous_let_type.rb
+++ b/app/models/form/lettings/questions/previous_let_type.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::PreviousLetType < ::Form::Question
@id = "unitletas"
@type = "radio"
@answer_options = answer_options
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -41,7 +41,7 @@ class Form::Lettings::Questions::PreviousLetType < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 16, 2024 => 17, 2025 => 14 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 16, 2024 => 17, 2025 => 14, 2026 => 14 }.freeze
def answer_options
return ANSWER_OPTIONS_AFTER_2025 if form.start_year_2025_or_later?
diff --git a/app/models/form/lettings/questions/previous_tenure.rb b/app/models/form/lettings/questions/previous_tenure.rb
index 47647b03c..65a3911b2 100644
--- a/app/models/form/lettings/questions/previous_tenure.rb
+++ b/app/models/form/lettings/questions/previous_tenure.rb
@@ -12,7 +12,7 @@ class Form::Lettings::Questions::PreviousTenure < ::Form::Question
else
ANSWER_OPTIONS
end
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -103,5 +103,5 @@ class Form::Lettings::Questions::PreviousTenure < ::Form::Question
"25" => { "value" => "Any other accommodation" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 78, 2024 => 77 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 78, 2024 => 77, 2025 => 77, 2026 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/previous_tenure_renewal.rb b/app/models/form/lettings/questions/previous_tenure_renewal.rb
index e932fd218..20f0900bb 100644
--- a/app/models/form/lettings/questions/previous_tenure_renewal.rb
+++ b/app/models/form/lettings/questions/previous_tenure_renewal.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::PreviousTenureRenewal < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = form.start_year_2025_or_later? ? ANSWER_OPTIONS_2025 : ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -22,5 +22,5 @@ class Form::Lettings::Questions::PreviousTenureRenewal < ::Form::Question
"6" => { "value" => "Other supported housing" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 78, 2024 => 77 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 78, 2024 => 77, 2025 => 77, 2026 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/prevloc.rb b/app/models/form/lettings/questions/prevloc.rb
index 4ad7dbf11..0bf445956 100644
--- a/app/models/form/lettings/questions/prevloc.rb
+++ b/app/models/form/lettings/questions/prevloc.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::Prevloc < ::Form::Question
@type = "select"
@inferred_check_answers_value = [{ "condition" => { "previous_la_known" => 0 }, "value" => "Not known" }]
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
end
@@ -14,5 +14,5 @@ class Form::Lettings::Questions::Prevloc < ::Form::Question
{ "" => "Select an option" }.merge(LocalAuthority.active(form.start_date).map { |la| [la.code, la.name] }.to_h)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 81, 2024 => 80 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 81, 2024 => 80, 2025 => 80, 2026 => 87 }.freeze
end
diff --git a/app/models/form/lettings/questions/property_reference.rb b/app/models/form/lettings/questions/property_reference.rb
index d4587ffe8..e81d4b6a2 100644
--- a/app/models/form/lettings/questions/property_reference.rb
+++ b/app/models/form/lettings/questions/property_reference.rb
@@ -4,8 +4,8 @@ class Form::Lettings::Questions::PropertyReference < ::Form::Question
@id = "propcode"
@type = "text"
@width = 10
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 8, 2024 => 10 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 8, 2024 => 10, 2025 => 10, 2026 => 10 }.freeze
end
diff --git a/app/models/form/lettings/questions/pscharge_4_weekly.rb b/app/models/form/lettings/questions/pscharge_4_weekly.rb
index 565be72c9..233e87854 100644
--- a/app/models/form/lettings/questions/pscharge_4_weekly.rb
+++ b/app/models/form/lettings/questions/pscharge_4_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::Pscharge4Weekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 4 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94, 2026 => 102 }.freeze
end
diff --git a/app/models/form/lettings/questions/pscharge_bi_weekly.rb b/app/models/form/lettings/questions/pscharge_bi_weekly.rb
index b8bb94f40..dcd1df89f 100644
--- a/app/models/form/lettings/questions/pscharge_bi_weekly.rb
+++ b/app/models/form/lettings/questions/pscharge_bi_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::PschargeBiWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 2 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94, 2026 => 102 }.freeze
end
diff --git a/app/models/form/lettings/questions/pscharge_monthly.rb b/app/models/form/lettings/questions/pscharge_monthly.rb
index ccbd2655b..b5c175ceb 100644
--- a/app/models/form/lettings/questions/pscharge_monthly.rb
+++ b/app/models/form/lettings/questions/pscharge_monthly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::PschargeMonthly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every month"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94, 2026 => 102 }.freeze
end
diff --git a/app/models/form/lettings/questions/pscharge_weekly.rb b/app/models/form/lettings/questions/pscharge_weekly.rb
index 9b0a0e320..4bf327c08 100644
--- a/app/models/form/lettings/questions/pscharge_weekly.rb
+++ b/app/models/form/lettings/questions/pscharge_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::PschargeWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every week"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 97, 2024 => 96, 2025 => 94, 2026 => 102 }.freeze
end
diff --git a/app/models/form/lettings/questions/reason.rb b/app/models/form/lettings/questions/reason.rb
index 7f0cd86a0..a40d9d134 100644
--- a/app/models/form/lettings/questions/reason.rb
+++ b/app/models/form/lettings/questions/reason.rb
@@ -10,7 +10,7 @@ class Form::Lettings::Questions::Reason < ::Form::Question
20,
],
}
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -132,5 +132,5 @@ class Form::Lettings::Questions::Reason < ::Form::Question
}.freeze,
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2024 => 76 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2024 => 76, 2025 => 76, 2026 => 83 }.freeze
end
diff --git a/app/models/form/lettings/questions/reason_renewal.rb b/app/models/form/lettings/questions/reason_renewal.rb
index c00bd2581..d5fccca67 100644
--- a/app/models/form/lettings/questions/reason_renewal.rb
+++ b/app/models/form/lettings/questions/reason_renewal.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::ReasonRenewal < ::Form::Question
@type = "radio"
@copy_key = "lettings.household_situation.reason.#{page.id}.reason"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@conditional_for = {
"reasonother" => [
20,
@@ -37,5 +37,5 @@ class Form::Lettings::Questions::ReasonRenewal < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 77, 2024 => 76 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 77, 2024 => 76, 2025 => 76, 2026 => 83 }.freeze
end
diff --git a/app/models/form/lettings/questions/reasonable_preference_reason.rb b/app/models/form/lettings/questions/reasonable_preference_reason.rb
index 75b450b91..485ad830f 100644
--- a/app/models/form/lettings/questions/reasonable_preference_reason.rb
+++ b/app/models/form/lettings/questions/reasonable_preference_reason.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::ReasonablePreferenceReason < ::Form::Question
@type = "checkbox"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -17,5 +17,5 @@ class Form::Lettings::Questions::ReasonablePreferenceReason < ::Form::Question
"rp_dontknow" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 83, 2024 => 82 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 83, 2024 => 82, 2025 => 82, 2026 => 89 }.freeze
end
diff --git a/app/models/form/lettings/questions/reasonother.rb b/app/models/form/lettings/questions/reasonother.rb
index 7e600916b..b92a7b8f4 100644
--- a/app/models/form/lettings/questions/reasonother.rb
+++ b/app/models/form/lettings/questions/reasonother.rb
@@ -5,8 +5,8 @@ class Form::Lettings::Questions::Reasonother < ::Form::Question
@copy_key = "lettings.household_situation.reason.#{@page.id}.reasonother"
@type = "text"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 77, 2024 => 76 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 77, 2024 => 76, 2025 => 76, 2026 => 83 }.freeze
end
diff --git a/app/models/form/lettings/questions/reasonpref.rb b/app/models/form/lettings/questions/reasonpref.rb
index e63f65584..f54e98c15 100644
--- a/app/models/form/lettings/questions/reasonpref.rb
+++ b/app/models/form/lettings/questions/reasonpref.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Reasonpref < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Reasonpref < ::Form::Question
"3" => { "value" => "Don’t know" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 82, 2024 => 81 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 82, 2024 => 81, 2025 => 81, 2026 => 88 }.freeze
end
diff --git a/app/models/form/lettings/questions/referral_direct.rb b/app/models/form/lettings/questions/referral_direct.rb
index ddadcc8b7..5373f3f3f 100644
--- a/app/models/form/lettings/questions/referral_direct.rb
+++ b/app/models/form/lettings/questions/referral_direct.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralDirect < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralDirect < ::Form::Question
@copy_key = "lettings.household_situation.referral.direct"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/referral_general_needs.rb b/app/models/form/lettings/questions/referral_general_needs.rb
index 6efdfc1f0..f2b2167a3 100644
--- a/app/models/form/lettings/questions/referral_general_needs.rb
+++ b/app/models/form/lettings/questions/referral_general_needs.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +6,7 @@ class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
@copy_key = "lettings.household_situation.referral.general_needs.la"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -92,5 +93,5 @@ class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84, 2025 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/referral_general_needs_prp.rb b/app/models/form/lettings/questions/referral_general_needs_prp.rb
index afd26117b..37d222961 100644
--- a/app/models/form/lettings/questions/referral_general_needs_prp.rb
+++ b/app/models/form/lettings/questions/referral_general_needs_prp.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Questions::ReferralGeneralNeedsPrp < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +6,7 @@ class Form::Lettings::Questions::ReferralGeneralNeedsPrp < ::Form::Question
@copy_key = "lettings.household_situation.referral.general_needs.prp"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -101,5 +102,5 @@ class Form::Lettings::Questions::ReferralGeneralNeedsPrp < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84, 2025 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/referral_hsc.rb b/app/models/form/lettings/questions/referral_hsc.rb
index a5b9c32f0..d589768a5 100644
--- a/app/models/form/lettings/questions/referral_hsc.rb
+++ b/app/models/form/lettings/questions/referral_hsc.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralHsc < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralHsc < ::Form::Question
@copy_key = "lettings.household_situation.referral.hsc"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/referral_justice.rb b/app/models/form/lettings/questions/referral_justice.rb
index 0e02e0c42..ccd836a2f 100644
--- a/app/models/form/lettings/questions/referral_justice.rb
+++ b/app/models/form/lettings/questions/referral_justice.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralJustice < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralJustice < ::Form::Question
@copy_key = "lettings.household_situation.referral.justice"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/referral_la.rb b/app/models/form/lettings/questions/referral_la.rb
index 7a654df88..ede72194c 100644
--- a/app/models/form/lettings/questions/referral_la.rb
+++ b/app/models/form/lettings/questions/referral_la.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralLa < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralLa < ::Form::Question
@copy_key = "lettings.household_situation.referral.la"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/referral_noms.rb b/app/models/form/lettings/questions/referral_noms.rb
new file mode 100644
index 000000000..4d1390fdd
--- /dev/null
+++ b/app/models/form/lettings/questions/referral_noms.rb
@@ -0,0 +1,49 @@
+# added in 2026
+class Form::Lettings::Questions::ReferralNoms < ::Form::Question
+ def initialize(id, hsh, page, referral_register)
+ super(id, hsh, page)
+ @id = "referral_noms"
+ @copy_key = "lettings.household_situation.referral.noms"
+ @type = "radio"
+ @check_answers_card_number = 0
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
+ @referral_register = referral_register
+ end
+
+ def answer_options
+ case @referral_register
+ when 6
+ {
+ "1" => {
+ "value" => "Nominated by a local authority to a PRP",
+ },
+ "2" => {
+ "value" => "Supported housing only - referred by a local authority to a PRP",
+ },
+ "3" => {
+ "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only",
+ },
+ "4" => {
+ "value" => "Other",
+ },
+ }.freeze
+ when 7
+ {
+ "5" => {
+ "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only",
+ },
+ "6" => {
+ "value" => " A different PRP landlord - for existing social tenants only",
+ },
+ "7" => {
+ "value" => "Directly referred by a third party",
+ },
+ "8" => {
+ "value" => "Other",
+ },
+ }.freeze
+ end
+ end
+
+ QUESTION_NUMBER_FROM_YEAR = { 2026 => 92 }.freeze
+end
diff --git a/app/models/form/lettings/questions/referral_org.rb b/app/models/form/lettings/questions/referral_org.rb
new file mode 100644
index 000000000..797e30074
--- /dev/null
+++ b/app/models/form/lettings/questions/referral_org.rb
@@ -0,0 +1,85 @@
+# added in 2026
+class Form::Lettings::Questions::ReferralOrg < ::Form::Question
+ def initialize(id, hsh, page, referral_noms)
+ super(id, hsh, page)
+ @id = "referral_org"
+ @copy_key = "lettings.household_situation.referral.org"
+ @type = "radio"
+ @check_answers_card_number = 0
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
+ @referral_noms = referral_noms
+ end
+
+ def answer_options
+ case @referral_noms
+ when 1
+ {
+ "1" => {
+ "value" => "Referred to LA by health service",
+ },
+ "2" => {
+ "value" => "Referred to LA by community learning disability team",
+ },
+ "3" => {
+ "value" => "Referred to LA by community mental health team",
+ },
+ "4" => {
+ "value" => "Referred to LA by adult social services",
+ },
+ "5" => {
+ "value" => "Referred to LA by children's social care",
+ },
+ "6" => {
+ "value" => "Referred to LA by police, probation, prison or youth offending team following a custodial sentence",
+ },
+ "7" => {
+ "value" => "Referred to LA by police, probation, prison or youth offending team without a custodial sentence",
+ },
+ "8" => {
+ "value" => "Referred to LA by a voluntary agency",
+ },
+ "9" => {
+ "value" => "Other referral",
+ },
+ "10" => {
+ "value" => "Don't know",
+ },
+ }.freeze
+ when 7
+ {
+ "11" => {
+ "value" => "Health service",
+ },
+ "12" => {
+ "value" => "Community learning disability team",
+ },
+ "13" => {
+ "value" => "Community mental health team",
+ },
+ "14" => {
+ "value" => "Adult social services",
+ },
+ "15" => {
+ "value" => "Children's social care",
+ },
+ "16" => {
+ "value" => "Police, probation, prison or youth offending team following a custodial sentence",
+ },
+ "17" => {
+ "value" => "Police, probation, prison or youth offending team without a custodial sentence",
+ },
+ "18" => {
+ "value" => "Voluntary agency",
+ },
+ "19" => {
+ "value" => "Other third party",
+ },
+ "20" => {
+ "value" => "Don't know",
+ },
+ }.freeze
+ end
+ end
+
+ QUESTION_NUMBER_FROM_YEAR = { 2026 => 92 }.freeze
+end
diff --git a/app/models/form/lettings/questions/referral_prp.rb b/app/models/form/lettings/questions/referral_prp.rb
index 44799bb8c..b0aed7b98 100644
--- a/app/models/form/lettings/questions/referral_prp.rb
+++ b/app/models/form/lettings/questions/referral_prp.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralPrp < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralPrp < ::Form::Question
@copy_key = "lettings.household_situation.referral.prp"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/referral_register.rb b/app/models/form/lettings/questions/referral_register.rb
new file mode 100644
index 000000000..cc3c25e74
--- /dev/null
+++ b/app/models/form/lettings/questions/referral_register.rb
@@ -0,0 +1,56 @@
+# added in 2026
+class Form::Lettings::Questions::ReferralRegister < ::Form::Question
+ def initialize(id, hsh, page, provider_type)
+ super(id, hsh, page)
+ @id = "referral_register"
+ @copy_key = "lettings.household_situation.referral.register"
+ @type = "radio"
+ @check_answers_card_number = 0
+ @provider_type = provider_type
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
+ @question_number += 1 if @provider_type == :prp
+ end
+
+ def answer_options
+ if @provider_type == :la
+ {
+ "1" => {
+ "value" => "Renewal to the same tenant in the same property",
+ },
+ "2" => {
+ "value" => "Internal transfer from another property owned by the same local authority - for existing social tenants only",
+ },
+ "3" => {
+ "value" => "From a housing register (waiting list)",
+ },
+ "4" => {
+ "value" => "Tenant applied directly (not via a nomination or housing register)",
+ },
+ }.freeze
+ else
+ {
+ "5" => {
+ "value" => "Renewal to the same tenant in the same property",
+ },
+ "6" => {
+ "value" => "From a local authority housing register (waiting list) or a register with local authority involvement",
+ },
+ "7" => {
+ "value" => "From a housing register (waiting list) with no local authority involvement",
+ },
+ "8" => {
+ "value" => "Tenant applied directly (not via a nomination or waiting list)",
+ },
+ "9" => {
+ "value" => "Don't know",
+ },
+ }.freeze
+ end
+ end
+
+ def derived?(log)
+ log.is_renewal?
+ end
+
+ QUESTION_NUMBER_FROM_YEAR = { 2026 => 91 }.freeze
+end
diff --git a/app/models/form/lettings/questions/referral_supported_housing.rb b/app/models/form/lettings/questions/referral_supported_housing.rb
index d8d05fade..2caddc8e2 100644
--- a/app/models/form/lettings/questions/referral_supported_housing.rb
+++ b/app/models/form/lettings/questions/referral_supported_housing.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Questions::ReferralSupportedHousing < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +6,7 @@ class Form::Lettings::Questions::ReferralSupportedHousing < ::Form::Question
@copy_key = "lettings.household_situation.referral.supported_housing.la"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -92,5 +93,5 @@ class Form::Lettings::Questions::ReferralSupportedHousing < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84, 2025 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/referral_supported_housing_prp.rb b/app/models/form/lettings/questions/referral_supported_housing_prp.rb
index 75cc218fe..89f02a723 100644
--- a/app/models/form/lettings/questions/referral_supported_housing_prp.rb
+++ b/app/models/form/lettings/questions/referral_supported_housing_prp.rb
@@ -1,3 +1,4 @@
+# removed in 2025
class Form::Lettings::Questions::ReferralSupportedHousingPrp < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +6,7 @@ class Form::Lettings::Questions::ReferralSupportedHousingPrp < ::Form::Question
@copy_key = "lettings.household_situation.referral.supported_housing.prp"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -104,5 +105,5 @@ class Form::Lettings::Questions::ReferralSupportedHousingPrp < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 85, 2024 => 84, 2025 => 84 }.freeze
end
diff --git a/app/models/form/lettings/questions/referral_type.rb b/app/models/form/lettings/questions/referral_type.rb
index 5ff0f411e..b84e85155 100644
--- a/app/models/form/lettings/questions/referral_type.rb
+++ b/app/models/form/lettings/questions/referral_type.rb
@@ -1,3 +1,5 @@
+# added in 2025
+# removed in 2026
class Form::Lettings::Questions::ReferralType < ::Form::Question
def initialize(id, hsh, page)
super
@@ -5,7 +7,7 @@ class Form::Lettings::Questions::ReferralType < ::Form::Question
@copy_key = "lettings.household_situation.referral.type"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
diff --git a/app/models/form/lettings/questions/renewal.rb b/app/models/form/lettings/questions/renewal.rb
index e78d98247..71007166b 100644
--- a/app/models/form/lettings/questions/renewal.rb
+++ b/app/models/form/lettings/questions/renewal.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::Renewal < ::Form::Question
@id = "renewal"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
ANSWER_OPTIONS = {
@@ -13,5 +13,5 @@ class Form::Lettings::Questions::Renewal < ::Form::Question
}
.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 4, 2024 => 6 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 4, 2024 => 6, 2025 => 6, 2026 => 6 }.freeze
end
diff --git a/app/models/form/lettings/questions/rent_type.rb b/app/models/form/lettings/questions/rent_type.rb
index 7700c5284..5940c18dc 100644
--- a/app/models/form/lettings/questions/rent_type.rb
+++ b/app/models/form/lettings/questions/rent_type.rb
@@ -7,7 +7,7 @@ class Form::Lettings::Questions::RentType < ::Form::Question
@top_guidance_partial = "rent_type_definitions"
@answer_options = answer_options
@conditional_for = { "irproduct_other" => [5] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
ANSWER_OPTIONS = {
@@ -29,7 +29,7 @@ class Form::Lettings::Questions::RentType < ::Form::Question
"6" => { "value" => "Specified accommodation - exempt accommodation, managed properties, refuges and local authority hostels" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 6, 2024 => 8 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 6, 2024 => 8, 2025 => 8, 2026 => 8 }.freeze
def answer_options
form.start_year_2025_or_later? ? ANSWER_OPTIONS_2025 : ANSWER_OPTIONS
diff --git a/app/models/form/lettings/questions/reservist.rb b/app/models/form/lettings/questions/reservist.rb
index 023f1655d..f6e97c3d8 100644
--- a/app/models/form/lettings/questions/reservist.rb
+++ b/app/models/form/lettings/questions/reservist.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Reservist < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -15,5 +15,5 @@ class Form::Lettings::Questions::Reservist < ::Form::Question
"3" => { "value" => "Person prefers not to say" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 68, 2024 => 67 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 68, 2024 => 67, 2025 => 67, 2026 => 74 }.freeze
end
diff --git a/app/models/form/lettings/questions/rsnvac.rb b/app/models/form/lettings/questions/rsnvac.rb
index 42c8d9f92..48523b284 100644
--- a/app/models/form/lettings/questions/rsnvac.rb
+++ b/app/models/form/lettings/questions/rsnvac.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Questions::Rsnvac < ::Form::Question
super
@id = "rsnvac"
@type = "radio"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -98,5 +98,5 @@ class Form::Lettings::Questions::Rsnvac < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 17, 2024 => 18, 2025 => 15 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 17, 2024 => 18, 2025 => 15, 2026 => 15 }.freeze
end
diff --git a/app/models/form/lettings/questions/rsnvac_first_let.rb b/app/models/form/lettings/questions/rsnvac_first_let.rb
index 01389871c..16d6219b6 100644
--- a/app/models/form/lettings/questions/rsnvac_first_let.rb
+++ b/app/models/form/lettings/questions/rsnvac_first_let.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::RsnvacFirstLet < ::Form::Question
@id = "rsnvac"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -13,5 +13,5 @@ class Form::Lettings::Questions::RsnvacFirstLet < ::Form::Question
"15" => { "value" => "First let of new-build property" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 15, 2024 => 16, 2025 => 13 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 15, 2024 => 16, 2025 => 13, 2026 => 13 }.freeze
end
diff --git a/app/models/form/lettings/questions/scharge_4_weekly.rb b/app/models/form/lettings/questions/scharge_4_weekly.rb
index 8c4156774..e95f5b1d2 100644
--- a/app/models/form/lettings/questions/scharge_4_weekly.rb
+++ b/app/models/form/lettings/questions/scharge_4_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::Scharge4Weekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 4 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/scharge_bi_weekly.rb b/app/models/form/lettings/questions/scharge_bi_weekly.rb
index 7803f8b37..24904797e 100644
--- a/app/models/form/lettings/questions/scharge_bi_weekly.rb
+++ b/app/models/form/lettings/questions/scharge_bi_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SchargeBiWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 2 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/scharge_monthly.rb b/app/models/form/lettings/questions/scharge_monthly.rb
index 073d4a772..631192bd4 100644
--- a/app/models/form/lettings/questions/scharge_monthly.rb
+++ b/app/models/form/lettings/questions/scharge_monthly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SchargeMonthly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every month"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/scharge_weekly.rb b/app/models/form/lettings/questions/scharge_weekly.rb
index b6befbad3..5f8aa9843 100644
--- a/app/models/form/lettings/questions/scharge_weekly.rb
+++ b/app/models/form/lettings/questions/scharge_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SchargeWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every week"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 96, 2024 => 95, 2025 => 93, 2026 => 101 }.freeze
end
diff --git a/app/models/form/lettings/questions/scheme_id.rb b/app/models/form/lettings/questions/scheme_id.rb
index 862ef3130..c9b371f40 100644
--- a/app/models/form/lettings/questions/scheme_id.rb
+++ b/app/models/form/lettings/questions/scheme_id.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question
@answer_options = answer_options
@top_guidance_partial = "finding_scheme"
@bottom_guidance_partial = "scheme_selection"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
@inferred_answers = {
"location.name": {
"scheme_has_multiple_locations?": false,
@@ -56,5 +56,5 @@ private
false
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 9, 2024 => 4 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 9, 2024 => 4, 2025 => 4, 2026 => 4 }.freeze
end
diff --git a/app/models/form/lettings/questions/sheltered.rb b/app/models/form/lettings/questions/sheltered.rb
index 35a16ae05..ca684c7af 100644
--- a/app/models/form/lettings/questions/sheltered.rb
+++ b/app/models/form/lettings/questions/sheltered.rb
@@ -3,7 +3,7 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question
super
@id = "sheltered"
@type = "radio"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -27,5 +27,5 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 29, 2024 => 29, 2025 => 25 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 29, 2024 => 29, 2025 => 25, 2026 => 24 }.freeze
end
diff --git a/app/models/form/lettings/questions/starter_tenancy_type.rb b/app/models/form/lettings/questions/starter_tenancy_type.rb
index dfda74bc0..4224781bd 100644
--- a/app/models/form/lettings/questions/starter_tenancy_type.rb
+++ b/app/models/form/lettings/questions/starter_tenancy_type.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::StarterTenancyType < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@conditional_for = { "tenancyother" => [3] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -65,5 +65,5 @@ class Form::Lettings::Questions::StarterTenancyType < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28, 2026 => 27 }.freeze
end
diff --git a/app/models/form/lettings/questions/startertenancy.rb b/app/models/form/lettings/questions/startertenancy.rb
index 6bec6a360..464e5d3a6 100644
--- a/app/models/form/lettings/questions/startertenancy.rb
+++ b/app/models/form/lettings/questions/startertenancy.rb
@@ -5,10 +5,10 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 26, 2024 => 26, 2025 => 27 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 26, 2024 => 26, 2025 => 27, 2026 => 26 }.freeze
end
diff --git a/app/models/form/lettings/questions/stock_owner.rb b/app/models/form/lettings/questions/stock_owner.rb
index 466b08e3f..6d2ee1d64 100644
--- a/app/models/form/lettings/questions/stock_owner.rb
+++ b/app/models/form/lettings/questions/stock_owner.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question
@id = "owning_organisation_id"
@derived = true
@type = "select"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
def answer_options(log = nil, user = nil)
@@ -86,5 +86,5 @@ private
"#{name} (inactive as of #{merge_date.to_fs(:govuk_date)})"
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 1 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 1, 2024 => 1, 2025 => 1, 2026 => 1 }.freeze
end
diff --git a/app/models/form/lettings/questions/supcharg_4_weekly.rb b/app/models/form/lettings/questions/supcharg_4_weekly.rb
index 227aead7a..1e3c502b2 100644
--- a/app/models/form/lettings/questions/supcharg_4_weekly.rb
+++ b/app/models/form/lettings/questions/supcharg_4_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::Supcharg4Weekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 4 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95, 2026 => 103 }.freeze
end
diff --git a/app/models/form/lettings/questions/supcharg_bi_weekly.rb b/app/models/form/lettings/questions/supcharg_bi_weekly.rb
index e01783122..4ad8048b8 100644
--- a/app/models/form/lettings/questions/supcharg_bi_weekly.rb
+++ b/app/models/form/lettings/questions/supcharg_bi_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SupchargBiWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every 2 weeks"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95, 2026 => 103 }.freeze
end
diff --git a/app/models/form/lettings/questions/supcharg_monthly.rb b/app/models/form/lettings/questions/supcharg_monthly.rb
index 25da179d2..85060eda9 100644
--- a/app/models/form/lettings/questions/supcharg_monthly.rb
+++ b/app/models/form/lettings/questions/supcharg_monthly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SupchargMonthly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every month"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95, 2026 => 103 }.freeze
end
diff --git a/app/models/form/lettings/questions/supcharg_weekly.rb b/app/models/form/lettings/questions/supcharg_weekly.rb
index c6f7a666d..e34473e17 100644
--- a/app/models/form/lettings/questions/supcharg_weekly.rb
+++ b/app/models/form/lettings/questions/supcharg_weekly.rb
@@ -12,9 +12,9 @@ class Form::Lettings::Questions::SupchargWeekly < ::Form::Question
@result_field = "tcharge"
@prefix = "£"
@suffix = " every week"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 98, 2024 => 97, 2025 => 95, 2026 => 103 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length.rb b/app/models/form/lettings/questions/tenancy_length.rb
index a3155f8c0..27ac9dbdc 100644
--- a/app/models/form/lettings/questions/tenancy_length.rb
+++ b/app/models/form/lettings/questions/tenancy_length.rb
@@ -9,8 +9,8 @@ class Form::Lettings::Questions::TenancyLength < ::Form::Question
@max = 150
@min = 0
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29, 2026 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb b/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
index 58b83fe90..f26adbe6f 100644
--- a/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
+++ b/app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
@@ -9,8 +9,8 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
@max = 150
@min = 0
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29, 2026 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb b/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
index c85583d95..ed3a13b0c 100644
--- a/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
+++ b/app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
@@ -9,8 +9,8 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
@max = 150
@min = 0
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29, 2026 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_length_periodic.rb b/app/models/form/lettings/questions/tenancy_length_periodic.rb
index e7f9336ec..85041680e 100644
--- a/app/models/form/lettings/questions/tenancy_length_periodic.rb
+++ b/app/models/form/lettings/questions/tenancy_length_periodic.rb
@@ -9,8 +9,8 @@ class Form::Lettings::Questions::TenancyLengthPeriodic < ::Form::Question
@max = 150
@min = 0
@step = 1
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 28, 2024 => 28, 2025 => 29, 2026 => 28 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_other.rb b/app/models/form/lettings/questions/tenancy_other.rb
index 8a8a94108..6f455fead 100644
--- a/app/models/form/lettings/questions/tenancy_other.rb
+++ b/app/models/form/lettings/questions/tenancy_other.rb
@@ -5,8 +5,8 @@ class Form::Lettings::Questions::TenancyOther < ::Form::Question
@copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancyother"
@type = "text"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28, 2026 => 27 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_start_date.rb b/app/models/form/lettings/questions/tenancy_start_date.rb
index cf1b556e7..fc5137626 100644
--- a/app/models/form/lettings/questions/tenancy_start_date.rb
+++ b/app/models/form/lettings/questions/tenancy_start_date.rb
@@ -1,11 +1,24 @@
class Form::Lettings::Questions::TenancyStartDate < ::Form::Question
+ include CollectionTimeHelper
+
def initialize(id, hsh, page)
super
@id = "startdate"
@type = "date"
@unresolved_hint_text = "Some scheme details have changed, and now this log needs updating. Check that the tenancy start date is correct."
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
+ end
+
+ def date_example_override(log)
+ return unless form.start_year_2026_or_later?
+
+ example_date =
+ [date_mid_collection_year(log.startdate), Time.zone.today + 7]
+ .min
+ .to_formatted_s(:govuk_date_number_month)
+ .tr(" ", "/")
+ I18n.t("forms.#{form.start_date.year}.#{copy_key}.example", default: "", example_date:)
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 5, 2024 => 7 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 5, 2024 => 7, 2025 => 7, 2026 => 7 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancy_type.rb b/app/models/form/lettings/questions/tenancy_type.rb
index 96fda2687..d2b9a5925 100644
--- a/app/models/form/lettings/questions/tenancy_type.rb
+++ b/app/models/form/lettings/questions/tenancy_type.rb
@@ -6,7 +6,7 @@ class Form::Lettings::Questions::TenancyType < ::Form::Question
@type = "radio"
@check_answers_card_number = 0
@conditional_for = { "tenancyother" => [3] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -65,5 +65,5 @@ class Form::Lettings::Questions::TenancyType < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 27, 2024 => 27, 2025 => 28, 2026 => 27 }.freeze
end
diff --git a/app/models/form/lettings/questions/tenancyother_value_check.rb b/app/models/form/lettings/questions/tenancyother_value_check.rb
new file mode 100644
index 000000000..309de7169
--- /dev/null
+++ b/app/models/form/lettings/questions/tenancyother_value_check.rb
@@ -0,0 +1,13 @@
+class Form::Lettings::Questions::TenancyotherValueCheck < ::Form::Question
+ def initialize(id, hsh, page)
+ super
+ @id = "tenancyother_value_check"
+ @copy_key = "lettings.soft_validations.tenancyother_value_check"
+ @type = "interruption_screen"
+ @check_answers_card_number = 0
+ @answer_options = ANSWER_OPTIONS
+ @hidden_in_check_answers = { "depends_on" => [{ "tenancyother_value_check" => 0 }, { "tenancyother_value_check" => 1 }] }
+ end
+
+ ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
+end
diff --git a/app/models/form/lettings/questions/tenant_code.rb b/app/models/form/lettings/questions/tenant_code.rb
index 7b7be3cac..36b3d0aee 100644
--- a/app/models/form/lettings/questions/tenant_code.rb
+++ b/app/models/form/lettings/questions/tenant_code.rb
@@ -4,8 +4,8 @@ class Form::Lettings::Questions::TenantCode < ::Form::Question
@id = "tenancycode"
@type = "text"
@width = 10
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) if form.start_date.present?
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 7, 2024 => 9 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 7, 2024 => 9, 2025 => 9, 2026 => 9 }.freeze
end
diff --git a/app/models/form/lettings/questions/town_or_city.rb b/app/models/form/lettings/questions/town_or_city.rb
index 5673b7f01..6db52c92d 100644
--- a/app/models/form/lettings/questions/town_or_city.rb
+++ b/app/models/form/lettings/questions/town_or_city.rb
@@ -6,9 +6,9 @@ class Form::Lettings::Questions::TownOrCity < ::Form::Question
@type = "text"
@plain_label = true
@disable_clearing_if_not_routed_or_dynamic_answer_options = true
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@hide_question_number_on_page = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 12, 2024 => 13, 2025 => 17, 2026 => 17 }.freeze
end
diff --git a/app/models/form/lettings/questions/tshortfall.rb b/app/models/form/lettings/questions/tshortfall.rb
index ced2a426a..a271f9e06 100644
--- a/app/models/form/lettings/questions/tshortfall.rb
+++ b/app/models/form/lettings/questions/tshortfall.rb
@@ -21,9 +21,9 @@ class Form::Lettings::Questions::Tshortfall < ::Form::Question
{ "label" => " every week for 52 weeks", "depends_on" => { "period" => 1 } },
{ "label" => " every week for 53 weeks", "depends_on" => { "period" => 10 } },
]
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@strip_commas = true
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 100, 2024 => 99, 2025 => 97 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 100, 2024 => 99, 2025 => 97, 2026 => 105 }.freeze
end
diff --git a/app/models/form/lettings/questions/tshortfall_known.rb b/app/models/form/lettings/questions/tshortfall_known.rb
index 8ba0b038c..97b41a09b 100644
--- a/app/models/form/lettings/questions/tshortfall_known.rb
+++ b/app/models/form/lettings/questions/tshortfall_known.rb
@@ -7,10 +7,10 @@ class Form::Lettings::Questions::TshortfallKnown < ::Form::Question
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@conditional_for = { "tshortfall" => [0] }
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 100, 2024 => 99, 2025 => 97 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 100, 2024 => 99, 2025 => 97, 2026 => 105 }.freeze
end
diff --git a/app/models/form/lettings/questions/unittype_gn.rb b/app/models/form/lettings/questions/unittype_gn.rb
index ad8298929..34391bf83 100644
--- a/app/models/form/lettings/questions/unittype_gn.rb
+++ b/app/models/form/lettings/questions/unittype_gn.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::UnittypeGn < ::Form::Question
@id = "unittype_gn"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -18,5 +18,5 @@ class Form::Lettings::Questions::UnittypeGn < ::Form::Question
"6" => { "value" => "Other" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 19 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 19, 2024 => 19, 2025 => 19, 2026 => 19 }.freeze
end
diff --git a/app/models/form/lettings/questions/uprn.rb b/app/models/form/lettings/questions/uprn.rb
index 7f1f240f9..98ffb75c2 100644
--- a/app/models/form/lettings/questions/uprn.rb
+++ b/app/models/form/lettings/questions/uprn.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
@copy_key = "lettings.property_information.uprn.uprn"
@type = "text"
@width = 10
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@inferred_check_answers_value = [
{
"condition" => { "uprn_known" => 0 },
@@ -35,5 +35,5 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
"\n\n#{value.join("\n")}"
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 11, 2024 => 12, 2025 => 16 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 11, 2024 => 12, 2025 => 16, 2026 => 16 }.freeze
end
diff --git a/app/models/form/lettings/questions/uprn_known.rb b/app/models/form/lettings/questions/uprn_known.rb
index 6ac70e415..5dab0f35a 100644
--- a/app/models/form/lettings/questions/uprn_known.rb
+++ b/app/models/form/lettings/questions/uprn_known.rb
@@ -18,7 +18,7 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question
{ "uprn_known" => 1 },
],
}
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -30,5 +30,5 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question
I18n.t("validations.property.uprn_known.invalid")
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 11, 2024 => 12, 2025 => 16 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 11, 2024 => 12, 2025 => 16, 2026 => 16 }.freeze
end
diff --git a/app/models/form/lettings/questions/voiddate.rb b/app/models/form/lettings/questions/voiddate.rb
index 3bce8a7b8..afdbb01ae 100644
--- a/app/models/form/lettings/questions/voiddate.rb
+++ b/app/models/form/lettings/questions/voiddate.rb
@@ -3,9 +3,9 @@ class Form::Lettings::Questions::Voiddate < ::Form::Question
super
@id = "voiddate"
@type = "date"
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
@top_guidance_partial = "void_date"
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 23 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 23, 2024 => 23, 2025 => 23, 2026 => 22 }.freeze
end
diff --git a/app/models/form/lettings/questions/waityear.rb b/app/models/form/lettings/questions/waityear.rb
index 5c81fdedc..7e0f2b77e 100644
--- a/app/models/form/lettings/questions/waityear.rb
+++ b/app/models/form/lettings/questions/waityear.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::Waityear < ::Form::Question
@id = "waityear"
@type = "radio"
@check_answers_card_number = 0
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -49,5 +49,5 @@ class Form::Lettings::Questions::Waityear < ::Form::Question
}.freeze
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 76, 2024 => 75 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 76, 2024 => 75, 2025 => 75, 2026 => 82 }.freeze
end
diff --git a/app/models/form/lettings/questions/wheelchair.rb b/app/models/form/lettings/questions/wheelchair.rb
index 9da5399e6..289e298f5 100644
--- a/app/models/form/lettings/questions/wheelchair.rb
+++ b/app/models/form/lettings/questions/wheelchair.rb
@@ -4,7 +4,7 @@ class Form::Lettings::Questions::Wheelchair < ::Form::Question
@id = "wchair"
@type = "radio"
@answer_options = ANSWER_OPTIONS
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
ANSWER_OPTIONS = {
@@ -12,5 +12,5 @@ class Form::Lettings::Questions::Wheelchair < ::Form::Question
"2" => { "value" => "No" },
}.freeze
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 21 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 21, 2024 => 21, 2025 => 21, 2026 => 20 }.freeze
end
diff --git a/app/models/form/lettings/questions/working_situation1.rb b/app/models/form/lettings/questions/working_situation1.rb
index 6098eb136..0a0221579 100644
--- a/app/models/form/lettings/questions/working_situation1.rb
+++ b/app/models/form/lettings/questions/working_situation1.rb
@@ -5,7 +5,7 @@ class Form::Lettings::Questions::WorkingSituation1 < ::Form::Question
@type = "radio"
@check_answers_card_number = 1
@answer_options = answer_options
- @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
+ @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def answer_options
@@ -40,5 +40,5 @@ class Form::Lettings::Questions::WorkingSituation1 < ::Form::Question
end
end
- QUESTION_NUMBER_FROM_YEAR = { 2023 => 37, 2024 => 36 }.freeze
+ QUESTION_NUMBER_FROM_YEAR = { 2023 => 37, 2024 => 36, 2025 => 36, 2026 => 36 }.freeze
end
diff --git a/app/models/form/lettings/subsections/household_characteristics.rb b/app/models/form/lettings/subsections/household_characteristics.rb
index d528e3772..e50a2c788 100644
--- a/app/models/form/lettings/subsections/household_characteristics.rb
+++ b/app/models/form/lettings/subsections/household_characteristics.rb
@@ -10,18 +10,21 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection
@pages ||= [
(Form::Lettings::Pages::Declaration.new(nil, nil, self) unless form.start_year_2024_or_later?),
Form::Lettings::Pages::HouseholdMembers.new(nil, nil, self),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadHhmembValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_hhmemb_check", nil, self) if form.start_year_2026_or_later?),
Form::Lettings::Pages::LeadTenantAge.new(nil, nil, self),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadAgeValueCheck.new(nil, nil, self),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadAgeValueCheck.new(nil, nil, self),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadAgeValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadAgeValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_lead_age_check", nil, self) if form.start_year_2026_or_later?),
Form::Lettings::Pages::LeadTenantUnderRetirementValueCheck.new("age_lead_tenant_under_retirement_value_check", nil, self),
Form::Lettings::Pages::LeadTenantOverRetirementValueCheck.new("age_lead_tenant_over_retirement_value_check", nil, self),
(Form::Lettings::Pages::LeadTenantSexRegisteredAtBirth.new(nil, nil, self) if form.start_year_2026_or_later?),
(Form::Lettings::Pages::LeadTenantGenderSameAsSex.new(nil, nil, self) if form.start_year_2026_or_later?),
- Form::Lettings::Pages::LeadTenantGenderIdentity.new(nil, nil, self),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadValueCheck.new(nil, nil, self),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadValueCheck.new(nil, nil, self),
+ (Form::Lettings::Pages::LeadTenantGenderIdentity.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdLeadValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdLeadValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_lead_check", nil, self, person_index: 1) if form.start_year_2026_or_later?),
Form::Lettings::Pages::LeadTenantOverRetirementValueCheck.new("gender_lead_tenant_over_retirement_value_check", nil, self),
Form::Lettings::Pages::LeadTenantEthnicGroup.new(nil, nil, self),
Form::Lettings::Pages::LeadTenantEthnicBackgroundArab.new(nil, nil, self),
@@ -52,16 +55,18 @@ class Form::Lettings::Subsections::HouseholdCharacteristics < ::Form::Subsection
(Form::Lettings::Pages::PartnerUnder16ValueCheck.new("relationship_#{person_index}_partner_under_16_value_check", nil, self, person_index:) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?),
(Form::Lettings::Pages::MultiplePartnersValueCheck.new("relationship_#{person_index}_multiple_partners_value_check", nil, self, person_index:) if form.start_year_2024_or_later?),
(Form::Lettings::Pages::PersonAge.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index:),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index:),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonAgeValueCheck.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_person_age_#{person_index}_check", nil, self, person_index:) if form.start_year_2026_or_later?),
Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("age_#{person_index}_under_retirement_value_check", nil, self, person_index:),
Form::Lettings::Pages::PersonOverRetirementValueCheck.new("age_#{person_index}_over_retirement_value_check", nil, self, person_index:),
(Form::Lettings::Pages::PartnerUnder16ValueCheck.new("age_#{person_index}_partner_under_16_value_check", nil, self, person_index:) if form.start_year_2024_or_later? && !form.start_year_2026_or_later?),
(Form::Lettings::Pages::PersonSexRegisteredAtBirth.new(nil, nil, self, person_index:) if form.start_year_2026_or_later?),
(Form::Lettings::Pages::PersonGenderSameAsSex.new(nil, nil, self, person_index:) if form.start_year_2026_or_later?),
- Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index:),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index:),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index:),
+ (Form::Lettings::Pages::PersonGenderIdentity.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdPersonValueCheck.new(nil, nil, self, person_index:) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_person_#{person_index}_check", nil, self, person_index:) if form.start_year_2026_or_later?),
Form::Lettings::Pages::PersonOverRetirementValueCheck.new("gender_#{person_index}_over_retirement_value_check", nil, self, person_index:),
Form::Lettings::Pages::PersonWorkingSituation.new(nil, nil, self, person_index:),
Form::Lettings::Pages::PersonUnderRetirementValueCheck.new("working_situation_#{person_index}_under_retirement_value_check", nil, self, person_index:),
diff --git a/app/models/form/lettings/subsections/household_needs.rb b/app/models/form/lettings/subsections/household_needs.rb
index e0502386b..4f6414d18 100644
--- a/app/models/form/lettings/subsections/household_needs.rb
+++ b/app/models/form/lettings/subsections/household_needs.rb
@@ -12,8 +12,9 @@ class Form::Lettings::Subsections::HouseholdNeeds < ::Form::Subsection
Form::Lettings::Pages::ArmedForcesServing.new(nil, nil, self),
Form::Lettings::Pages::ArmedForcesInjured.new(nil, nil, self),
Form::Lettings::Pages::Pregnant.new("pregnant", nil, self),
- Form::Lettings::Pages::NoFemalesPregnantHouseholdValueCheck.new(nil, nil, self),
- Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdValueCheck.new(nil, nil, self),
+ (Form::Lettings::Pages::NoFemalesPregnantHouseholdValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::FemalesInSoftAgeRangeInPregnantHouseholdValueCheck.new(nil, nil, self) unless form.start_year_2026_or_later?),
+ (Form::Lettings::Pages::NoHouseholdMemberLikelyToBePregnantCheck.new("no_household_member_likely_to_be_pregnant_check", nil, self) if form.start_year_2026_or_later?),
Form::Lettings::Pages::AccessNeedsExist.new("access_needs_exist", nil, self),
Form::Lettings::Pages::TypeOfAccessNeeds.new(nil, nil, self),
Form::Lettings::Pages::HealthConditions.new("health_conditions", nil, self),
diff --git a/app/models/form/lettings/subsections/household_situation.rb b/app/models/form/lettings/subsections/household_situation.rb
index 8bf747f01..cc6ec59de 100644
--- a/app/models/form/lettings/subsections/household_situation.rb
+++ b/app/models/form/lettings/subsections/household_situation.rb
@@ -22,12 +22,20 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection
Form::Lettings::Pages::ReasonablePreferenceReason.new(nil, nil, self),
Form::Lettings::Pages::AllocationSystem.new("allocation_system", nil, self),
referral_questions,
- Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self),
].flatten.compact
end
def referral_questions
- if form.start_year_2025_or_later?
+ if form.start_year_2026_or_later?
+ [
+ Form::Lettings::Pages::ReferralRegisterLa.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralRegisterPrp.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralNomsLaHr.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralNomsHr.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralOrgNominated.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralOrgDirectlyReferred.new(nil, nil, self),
+ ]
+ elsif form.start_year_2025_or_later?
[
Form::Lettings::Pages::ReferralType.new(nil, nil, self),
Form::Lettings::Pages::ReferralDirect.new(nil, nil, self),
@@ -35,6 +43,7 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection
Form::Lettings::Pages::ReferralPrp.new(nil, nil, self),
Form::Lettings::Pages::ReferralHsc.new(nil, nil, self),
Form::Lettings::Pages::ReferralJustice.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self),
]
else
[
@@ -42,6 +51,7 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection
Form::Lettings::Pages::ReferralGeneralNeedsPrp.new(nil, nil, self),
Form::Lettings::Pages::ReferralSupportedHousing.new(nil, nil, self),
Form::Lettings::Pages::ReferralSupportedHousingPrp.new(nil, nil, self),
+ Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self),
]
end
end
diff --git a/app/models/form/lettings/subsections/tenancy_information.rb b/app/models/form/lettings/subsections/tenancy_information.rb
index b65039b8d..e6ff48457 100644
--- a/app/models/form/lettings/subsections/tenancy_information.rb
+++ b/app/models/form/lettings/subsections/tenancy_information.rb
@@ -12,6 +12,7 @@ class Form::Lettings::Subsections::TenancyInformation < ::Form::Subsection
Form::Lettings::Pages::StarterTenancy.new("starter_tenancy", nil, self),
Form::Lettings::Pages::TenancyType.new(nil, nil, self),
Form::Lettings::Pages::StarterTenancyType.new(nil, nil, self),
+ (Form::Lettings::Pages::TenancyotherValueCheck.new(nil, nil, self) if form.start_year_2026_or_later?),
Form::Lettings::Pages::TenancyLength.new(nil, nil, self),
Form::Lettings::Pages::TenancyLengthAffordableRent.new(nil, nil, self),
Form::Lettings::Pages::TenancyLengthIntermediateRent.new(nil, nil, self),
diff --git a/app/models/form/question.rb b/app/models/form/question.rb
index b6f3b8b2f..be90899f9 100644
--- a/app/models/form/question.rb
+++ b/app/models/form/question.rb
@@ -299,6 +299,11 @@ class Form::Question
answer_options.keys.reject { |x| x.match(/divider/) }
end
+ # used by date questions that need bespoke formatting for the example date
+ def date_example_override(_log)
+ nil
+ end
+
private
def selected_answer_option_is_derived?(log)
@@ -362,6 +367,13 @@ private
inferred_answer["value"] if inferred_answer.present?
end
+ # every year currently visible should have an explicit question number specified.
+ # however, form_handler.rb will still initialise the next form even if its not visible.
+ # so we have a fallback to the latest year for these future years so all question have a question number.
+ def get_question_number_from_hash(hash)
+ hash[form.start_date.year] || hash[hash.keys.max]
+ end
+
RADIO_YES_VALUE = {
renewal: [1],
postcode_known: [1],
@@ -434,6 +446,14 @@ private
sex6: %w[R],
sex7: %w[R],
sex8: %w[R],
+ sexrab1: %w[R],
+ sexrab2: %w[R],
+ sexrab3: %w[R],
+ sexrab4: %w[R],
+ sexrab5: %w[R],
+ sexrab6: %w[R],
+ sexrab7: %w[R],
+ sexrab8: %w[R],
relat2: [3],
relat3: [3],
relat4: [3],
diff --git a/app/models/form/sales/pages/deposit.rb b/app/models/form/sales/pages/deposit.rb
index 4fc5e1b83..411cfb270 100644
--- a/app/models/form/sales/pages/deposit.rb
+++ b/app/models/form/sales/pages/deposit.rb
@@ -23,6 +23,7 @@ class Form::Sales::Pages::Deposit < ::Form::Page
def copy_key
return "sales.sale_information.deposit.shared_ownership" if @ownershipsch == 1
return "sales.sale_information.deposit.discounted_ownership" if @ownershipsch == 2
- return "sales.sale_information.deposit.outright_sale" if @ownershipsch == 3
+
+ "sales.sale_information.deposit.outright_sale" if @ownershipsch == 3
end
end
diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb
index 9fe7a7ce1..ede6335e1 100644
--- a/app/models/form/sales/questions/deposit_amount.rb
+++ b/app/models/form/sales/questions/deposit_amount.rb
@@ -29,12 +29,14 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question
def top_guidance_partial
return "financial_calculations_shared_ownership" if @ownershipsch == 1
return "financial_calculations_discounted_ownership" if @ownershipsch == 2
- return "financial_calculations_outright_sale" if @ownershipsch == 3
+
+ "financial_calculations_outright_sale" if @ownershipsch == 3
end
def copy_key
return "sales.sale_information.deposit.shared_ownership" if @ownershipsch == 1
return "sales.sale_information.deposit.discounted_ownership" if @ownershipsch == 2
- return "sales.sale_information.deposit.outright_sale" if @ownershipsch == 3
+
+ "sales.sale_information.deposit.outright_sale" if @ownershipsch == 3
end
end
diff --git a/app/models/form/sales/questions/mortgage_amount.rb b/app/models/form/sales/questions/mortgage_amount.rb
index 0d2bda4fd..a61dce8f3 100644
--- a/app/models/form/sales/questions/mortgage_amount.rb
+++ b/app/models/form/sales/questions/mortgage_amount.rb
@@ -26,6 +26,7 @@ class Form::Sales::Questions::MortgageAmount < ::Form::Question
def top_guidance_partial
return "financial_calculations_shared_ownership" if @ownershipsch == 1
return "financial_calculations_discounted_ownership" if @ownershipsch == 2
- return "financial_calculations_outright_sale" if @ownershipsch == 3
+
+ "financial_calculations_outright_sale" if @ownershipsch == 3
end
end
diff --git a/app/models/form/sales/questions/mortgageused.rb b/app/models/form/sales/questions/mortgageused.rb
index a0079b1b4..fc5818886 100644
--- a/app/models/form/sales/questions/mortgageused.rb
+++ b/app/models/form/sales/questions/mortgageused.rb
@@ -41,6 +41,7 @@ class Form::Sales::Questions::Mortgageused < ::Form::Question
def top_guidance_partial
return "financial_calculations_shared_ownership" if @ownershipsch == 1
return "financial_calculations_discounted_ownership" if @ownershipsch == 2
- return "financial_calculations_outright_sale" if @ownershipsch == 3
+
+ "financial_calculations_outright_sale" if @ownershipsch == 3
end
end
diff --git a/app/models/form/sales/questions/person_sex_registered_at_birth.rb b/app/models/form/sales/questions/person_sex_registered_at_birth.rb
index ff61f3ee0..2ea4e35df 100644
--- a/app/models/form/sales/questions/person_sex_registered_at_birth.rb
+++ b/app/models/form/sales/questions/person_sex_registered_at_birth.rb
@@ -16,4 +16,12 @@ class Form::Sales::Questions::PersonSexRegisteredAtBirth < ::Form::Question
}.freeze
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze
+
+ def label_from_value(value, _log = nil, _user = nil)
+ return unless value
+
+ return "Prefers not to say" if value == "R"
+
+ super
+ end
end
diff --git a/app/models/form/sales/questions/purchase_price.rb b/app/models/form/sales/questions/purchase_price.rb
index 56810eae4..d37d549ce 100644
--- a/app/models/form/sales/questions/purchase_price.rb
+++ b/app/models/form/sales/questions/purchase_price.rb
@@ -30,6 +30,7 @@ class Form::Sales::Questions::PurchasePrice < ::Form::Question
def top_guidance_partial
return "financial_calculations_discounted_ownership" if @ownership_sch == 2
- return "financial_calculations_outright_sale" if @ownership_sch == 3
+
+ "financial_calculations_outright_sale" if @ownership_sch == 3
end
end
diff --git a/app/models/form/sales/questions/sex_registered_at_birth1.rb b/app/models/form/sales/questions/sex_registered_at_birth1.rb
index 77a8e3fc3..23a1e65c2 100644
--- a/app/models/form/sales/questions/sex_registered_at_birth1.rb
+++ b/app/models/form/sales/questions/sex_registered_at_birth1.rb
@@ -16,4 +16,12 @@ class Form::Sales::Questions::SexRegisteredAtBirth1 < ::Form::Question
}.freeze
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze
+
+ def label_from_value(value, _log = nil, _user = nil)
+ return unless value
+
+ return "Prefers not to say" if value == "R"
+
+ super
+ end
end
diff --git a/app/models/form/sales/questions/sex_registered_at_birth2.rb b/app/models/form/sales/questions/sex_registered_at_birth2.rb
index 6f9c77eb4..5c8f2b3a6 100644
--- a/app/models/form/sales/questions/sex_registered_at_birth2.rb
+++ b/app/models/form/sales/questions/sex_registered_at_birth2.rb
@@ -17,4 +17,12 @@ class Form::Sales::Questions::SexRegisteredAtBirth2 < ::Form::Question
}.freeze
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze
+
+ def label_from_value(value, _log = nil, _user = nil)
+ return unless value
+
+ return "Prefers not to say" if value == "R"
+
+ super
+ end
end
diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb
index 3b74e29a5..41431b06f 100644
--- a/app/models/form/subsection.rb
+++ b/app/models/form/subsection.rb
@@ -1,5 +1,5 @@
class Form::Subsection
- attr_accessor :id, :label, :section, :pages, :depends_on, :form
+ attr_accessor :id, :label, :section, :pages, :depends_on
def initialize(id, hsh, section)
@id = id
diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb
index f2230c4e5..d70d0e012 100644
--- a/app/models/lettings_log.rb
+++ b/app/models/lettings_log.rb
@@ -35,6 +35,7 @@ class LettingsLog < Log
before_validation :set_derived_fields!
before_validation :process_uprn_change!, if: :should_process_uprn_change?
before_validation :process_address_change!, if: :should_process_address_change?
+ before_validation :reset_referral_register!, if: :should_reset_referral_register?
belongs_to :scheme, optional: true
belongs_to :location, optional: true
@@ -376,8 +377,12 @@ class LettingsLog < Log
end
def is_internal_transfer?
- # 1: Internal Transfer
- referral == 1
+ if form.start_year_2026_or_later?
+ referral_register == 2 || (referral_register == 6 && referral_noms == 3) || (referral_register == 7 && referral_noms == 5)
+ else
+ # 1: Internal Transfer
+ referral == 1
+ end
end
def is_from_prp_only_housing_register_or_waiting_list?
@@ -477,7 +482,7 @@ class LettingsLog < Log
def is_london_rent?
# 2: London Affordable Rent
# 4: London Living Rent
- rent_type == 2 || rent_type == 4
+ [2, 4].include?(rent_type)
end
def previous_tenancy_was_foster_care?
@@ -544,6 +549,12 @@ class LettingsLog < Log
[30, 31].any?(prevten)
end
+ def is_prevten_general_needs?
+ return false unless prevten
+
+ ![30, 31, 32, 33, 35, 38, 40, 6].include?(prevten)
+ end
+
def owning_organisation_name
owning_organisation&.name
end
@@ -676,7 +687,7 @@ class LettingsLog < Log
end
def has_any_person_details?(person_index)
- ["sex#{person_index}", "relat#{person_index}", "ecstat#{person_index}"].any? { |field| public_send(field).present? } || public_send("age#{person_index}_known") == 1
+ ["sex#{person_index}", "sexrab#{person_index}", "relat#{person_index}", "ecstat#{person_index}"].any? { |field| public_send(field).present? } || public_send("age#{person_index}_known") == 1
end
def details_not_known_for_person?(person_index)
@@ -703,7 +714,7 @@ class LettingsLog < Log
end
def affordable_or_social_rent?
- renttype == 1 || renttype == 2
+ [1, 2].include?(renttype)
end
def no_or_unknown_other_housing_needs?
@@ -776,6 +787,22 @@ class LettingsLog < Log
form.start_year_2026_or_later? || !is_supported_housing?
end
+ def referral_is_from_local_authority_housing_register?
+ referral_register == 6
+ end
+
+ def referral_is_from_housing_register?
+ referral_register == 7
+ end
+
+ def referral_is_nominated_by_local_authority?
+ referral_is_from_local_authority_housing_register? && referral_noms == 1
+ end
+
+ def referral_is_directly_referred?
+ referral_is_from_housing_register? && referral_noms == 7
+ end
+
private
def reset_invalid_unresolved_log_fields!
@@ -884,6 +911,10 @@ private
[sex1, sex2, sex3, sex4, sex5, sex6, sex7, sex8].any?("R")
end
+ def sexrab_refused?
+ [sexrab1, sexrab2, sexrab3, sexrab4, sexrab5, sexrab6, sexrab7, sexrab8].any?("R")
+ end
+
def relat_refused?
[relat2, relat3, relat4, relat5, relat6, relat7, relat8].any?("R")
end
@@ -900,7 +931,7 @@ private
num_of_weeks = NUM_OF_WEEKS_FROM_PERIOD[period]
return "" unless value && num_of_weeks
- format_as_currency((value * 52 / num_of_weeks))
+ format_as_currency(value * 52 / num_of_weeks)
end
def fully_wheelchair_accessible?
@@ -947,4 +978,16 @@ private
uprn_selection_changed? || startdate_changed?
end
end
+
+ def reset_referral_register!
+ self.referral_register = nil
+ end
+
+ def should_reset_referral_register?
+ return unless owning_organisation_id_changed? && owning_organisation_id && owning_organisation_id_was
+
+ old_owning_organisation = Organisation.find(owning_organisation_id_was)
+
+ old_owning_organisation.provider_type != owning_organisation.provider_type
+ end
end
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index 94390c3f9..b33d896c4 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -74,6 +74,7 @@ class Organisation < ApplicationRecord
before_save :clear_group_member_fields_if_not_group_member
alias_method :la?, :LA?
+ alias_method :prp?, :PRP?
validates :name, presence: { message: I18n.t("validations.organisation.name_missing") }
validates :name, uniqueness: { case_sensitive: false, message: I18n.t("validations.organisation.name_not_unique") }
diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb
index d4d23f44d..cf9e0dd44 100644
--- a/app/models/sales_log.rb
+++ b/app/models/sales_log.rb
@@ -533,7 +533,7 @@ class SalesLog < Log
end
def is_not_staircasing?
- staircase == 2 || staircase == 3
+ [2, 3].include?(staircase)
end
def stairowned_100?
diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb
index 8ba58ba2b..cf1962be0 100644
--- a/app/models/validations/household_validations.rb
+++ b/app/models/validations/household_validations.rb
@@ -162,7 +162,7 @@ module Validations::HouseholdValidations
# 27 Owner occupation (low-cost home ownership)
# 28 Living with Friends or Family
# 29 Prison / Approved Probation Hostel
- if record.is_internal_transfer? && [3, 4, 7, 10, 13, 14, 19, 23, 24, 25, 26, 27, 28, 29].include?(record.prevten)
+ if record.is_internal_transfer? && [3, 4, 7, 10, 13, 14, 19, 23, 24, 25, 26, 27, 28, 29].include?(record.prevten) && !record.form.start_year_2026_or_later?
label = record.form.get_question("prevten", record).present? ? record.form.get_question("prevten", record).label_from_value(record.prevten) : ""
record.errors.add :prevten, :internal_transfer_non_social_housing, message: I18n.t("validations.lettings.household.prevten.internal_transfer", prevten: label)
record.errors.add :referral, :internal_transfer_non_social_housing, message: I18n.t("validations.lettings.household.referral.prevten_invalid", prevten: label)
@@ -172,7 +172,14 @@ module Validations::HouseholdValidations
def validate_referral(record)
return unless record.owning_organisation
- if record.is_internal_transfer? && record.owning_organisation.provider_type == "PRP" && record.is_prevten_la_general_needs?
+ if record.form.start_year_2026_or_later?
+ if record.is_internal_transfer? && record.is_prevten_general_needs?
+ label = record.form.get_question("prevten", record).present? ? record.form.get_question("prevten", record).label_from_value(record.prevten) : ""
+ record.errors.add :prevten, message: I18n.t("validations.lettings.household.prevten.general_needs.internal_transfer", prevten: label)
+ record.errors.add :referral_register, message: I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: label)
+ record.errors.add :referral_noms, message: I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: label)
+ end
+ elsif record.is_internal_transfer? && record.owning_organisation.prp? && record.is_prevten_la_general_needs?
record.errors.add :prevten, :internal_transfer_fixed_or_lifetime, message: I18n.t("validations.lettings.household.prevten.la_general_needs.internal_transfer")
record.errors.add :referral, :internal_transfer_fixed_or_lifetime, message: I18n.t("validations.lettings.household.referral.la_general_needs.internal_transfer")
end
diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb
index f34eec790..063c16599 100644
--- a/app/models/validations/sales/sale_information_validations.rb
+++ b/app/models/validations/sales/sale_information_validations.rb
@@ -136,7 +136,7 @@ module Validations::Sales::SaleInformationValidations
def validate_grant_amount(record)
return unless record.saledate && record.form.start_year_2024_or_later?
- return unless record.grant && (record.type == 8 || record.type == 21)
+ return unless record.grant && [8, 21].include?(record.type)
unless record.grant.between?(9_000, 16_000)
record.errors.add :grant, I18n.t("validations.sales.sale_information.grant.out_of_range")
diff --git a/app/models/validations/sales/soft_validations.rb b/app/models/validations/sales/soft_validations.rb
index 2bc574774..3569c379f 100644
--- a/app/models/validations/sales/soft_validations.rb
+++ b/app/models/validations/sales/soft_validations.rb
@@ -144,7 +144,7 @@ module Validations::Sales::SoftValidations
def grant_outside_common_range?
return unless grant && type && saledate
- return if form.start_year_2024_or_later? && (type == 21 || type == 8)
+ return if form.start_year_2024_or_later? && [21, 8].include?(type)
!grant.between?(9_000, 16_000)
end
diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb
index 530735213..4558a5a36 100644
--- a/app/models/validations/shared_validations.rb
+++ b/app/models/validations/shared_validations.rb
@@ -56,11 +56,11 @@ module Validations::SharedValidations
next unless incorrect_accuracy
- case question.step
- when 0.01 then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_hundredth", field:)
- when 0.1 then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_tenth", field:)
- when 1 then record.errors.add question.id.to_sym, :not_integer, message: I18n.t("validations.shared.numeric.whole_number", field:)
- when 10 then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_ten", field:)
+ case question.step.to_d
+ when BigDecimal("0.01") then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_hundredth", field:)
+ when BigDecimal("0.1") then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_tenth", field:)
+ when BigDecimal("1") then record.errors.add question.id.to_sym, :not_integer, message: I18n.t("validations.shared.numeric.whole_number", field:)
+ when BigDecimal("10") then record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_ten", field:)
else
record.errors.add question.id.to_sym, I18n.t("validations.shared.numeric.nearest_step", field:, step: question.step)
end
diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb
index 35436dc32..ea17d0601 100644
--- a/app/models/validations/soft_validations.rb
+++ b/app/models/validations/soft_validations.rb
@@ -75,30 +75,16 @@ module Validations::SoftValidations
end
end
- def all_male_tenants_in_a_pregnant_household?
- all_male_tenants_in_the_household? && all_tenants_gender_information_completed? && preg_occ == 1
+ def no_household_member_likely_to_be_pregnant?
+ all_male_tenants_in_a_pregnant_household? || non_males_in_pregnant_household_not_in_pregnancy_range?
end
- def female_in_pregnant_household_in_soft_validation_range?
- all_tenants_age_and_gender_information_completed? && females_in_the_household? && !females_in_age_range(16, 50) && preg_occ == 1
+ def all_male_tenants_in_a_pregnant_household?
+ all_tenants_gender_information_completed? && all_male_tenants_in_the_household? && preg_occ == 1
end
- def all_tenants_age_and_gender_information_completed?
- return false if hhmemb.present? && hhmemb > 8
-
- person_count = hhmemb || 8
-
- (1..person_count).all? do |n|
- public_send("sex#{n}").present? && public_send("age#{n}").present? && details_known_or_lead_tenant?(n) && public_send("age#{n}_known").present? && public_send("age#{n}_known").zero?
- end
- end
-
- def all_tenants_gender_information_completed?
- person_count = hhmemb || 8
-
- (1..person_count).all? do |n|
- public_send("sex#{n}").present? && details_known_or_lead_tenant?(n)
- end
+ def non_males_in_pregnant_household_not_in_pregnancy_range?
+ all_tenants_age_and_gender_information_completed? && non_males_in_the_household? && !any_non_male_in_expected_pregnancy_age_range(16, 50) && preg_occ == 1
end
TWO_YEARS_IN_DAYS = 730
@@ -208,6 +194,16 @@ module Validations::SoftValidations
PHRASES_LIKELY_TO_INDICATE_EXISTING_REASON_CATEGORY_REGEX.match?(reasonother)
end
+ PHRASES_LIKELY_TO_INDICATE_INTRODUCTORY_OR_STARTER_PERIOD = %w[introductory intro starter].freeze
+
+ PHRASES_LIKELY_TO_INDICATE_INTRODUCTORY_OR_STARTER_PERIOD_REGEX = Regexp.union(
+ PHRASES_LIKELY_TO_INDICATE_INTRODUCTORY_OR_STARTER_PERIOD.map { |phrase| Regexp.new("\\b[^[:alpha]]*#{phrase}[^[:alpha:]]*\\b", Regexp::IGNORECASE) },
+ )
+
+ def tenancyother_might_be_introductory_or_starter_period?
+ PHRASES_LIKELY_TO_INDICATE_INTRODUCTORY_OR_STARTER_PERIOD_REGEX.match?(tenancyother)
+ end
+
def multiple_partners?
return unless hhmemb
@@ -221,25 +217,54 @@ module Validations::SoftValidations
private
+ def all_tenants_age_and_gender_information_completed?
+ return false if hhmemb.present? && hhmemb > 8
+ return false unless all_tenants_gender_information_completed?
+
+ person_count = hhmemb || 8
+
+ (1..person_count).all? do |n|
+ public_send("age#{n}").present? && public_send("age#{n}_known").present? && public_send("age#{n}_known").zero?
+ end
+ end
+
+ def all_tenants_gender_information_completed?
+ return false if hhmemb.present? && hhmemb > 8
+
+ person_count = hhmemb || 8
+
+ (1..person_count).all? do |n|
+ tenant_gender_information_completed?(n)
+ end
+ end
+
+ def tenant_gender_information_completed?(tenant_number)
+ if form.start_year_2026_or_later?
+ public_send("sexrab#{tenant_number}").present? && public_send("gender_same_as_sex#{tenant_number}").present? && details_known_or_lead_tenant?(tenant_number)
+ else
+ public_send("sex#{tenant_number}").present? && details_known_or_lead_tenant?(tenant_number)
+ end
+ end
+
def details_known_or_lead_tenant?(tenant_number)
return true if tenant_number == 1
public_send("details_known_#{tenant_number}").zero?
end
- def females_in_age_range(min, max)
+ def any_non_male_in_expected_pregnancy_age_range(min, max)
person_count = hhmemb || 8
(1..person_count).any? do |n|
- public_send("sex#{n}") == "F" && public_send("age#{n}").present? && public_send("age#{n}").between?(min, max)
+ person_in_expected_pregnancy_age_range(n, min, max) && person_is_non_male(n)
end
end
- def females_in_the_household?
+ def non_males_in_the_household?
person_count = hhmemb || 8
(1..person_count).any? do |n|
- public_send("sex#{n}") == "F" || public_send("sex#{n}").nil?
+ person_is_non_male(n)
end
end
@@ -249,10 +274,36 @@ private
person_count = hhmemb || 8
(1..person_count).all? do |n|
- public_send("sex#{n}") == "M"
+ person_is_male(n)
end
end
+ def person_is_male(person_number)
+ if form.start_year_2026_or_later?
+ sexrab = public_send("sexrab#{person_number}")
+ gender_same_as_sex = public_send("gender_same_as_sex#{person_number}")
+
+ sexrab == "M" && gender_same_as_sex == 1
+ else
+ public_send("sex#{person_number}") == "M"
+ end
+ end
+
+ def person_is_non_male(person_number)
+ if form.start_year_2026_or_later?
+ !person_is_male(person_number)
+ else
+ # the "non-male" wording was introduced in the 26/27 collection year, before that this behavior was limited to female gender only
+ public_send("sex#{person_number}") == "F"
+ end
+ end
+
+ def person_in_expected_pregnancy_age_range(person_number, min, max)
+ age = public_send("age#{person_number}")
+
+ age.between?(min, max)
+ end
+
def tenant_is_retired?(economic_status)
economic_status == 5
end
@@ -288,6 +339,8 @@ private
end
def at_least_one_person_working_situation_is_illness?
+ return if hhmemb.present? && hhmemb > 8
+
person_count = hhmemb || 8
(1..person_count).any? { |n| public_send("ecstat#{n}") == 8 }
diff --git a/app/policies/location_policy.rb b/app/policies/location_policy.rb
index 3b4a22131..966cfe35c 100644
--- a/app/policies/location_policy.rb
+++ b/app/policies/location_policy.rb
@@ -32,7 +32,7 @@ class LocationPolicy
def delete?
return false unless user.support?
- return false unless location.status == :incomplete || location.status == :deactivated
+ return false unless %i[incomplete deactivated].include?(location.status)
!has_any_logs_in_editable_collection_period
end
diff --git a/app/policies/organisation_policy.rb b/app/policies/organisation_policy.rb
index 9c5fc4449..4db37b5ea 100644
--- a/app/policies/organisation_policy.rb
+++ b/app/policies/organisation_policy.rb
@@ -20,7 +20,7 @@ class OrganisationPolicy
def delete?
return false unless user.support?
- return false unless organisation.status == :deactivated || organisation.status == :merged
+ return false unless %i[deactivated merged].include?(organisation.status)
!has_any_logs_in_editable_collection_period
end
diff --git a/app/policies/scheme_policy.rb b/app/policies/scheme_policy.rb
index 54a2b9e89..6fa9ac95a 100644
--- a/app/policies/scheme_policy.rb
+++ b/app/policies/scheme_policy.rb
@@ -71,7 +71,7 @@ class SchemePolicy
def delete?
return false unless user.support?
- return false unless scheme.status == :incomplete || scheme.status == :deactivated
+ return false unless %i[incomplete deactivated].include?(scheme.status)
!has_any_logs_in_editable_collection_period
end
diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb
index 70aa4951e..1e8b9db56 100644
--- a/app/services/bulk_upload/lettings/year2023/row_parser.rb
+++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb
@@ -536,7 +536,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next unless question&.type == "radio"
@@ -1321,22 +1321,26 @@ private
def scheme_field
return :field_16 if log_uses_new_scheme_id?
- return :field_15 if log_uses_old_scheme_id?
+
+ :field_15 if log_uses_old_scheme_id?
end
def scheme_id
return field_16.strip if log_uses_new_scheme_id?
- return field_15 if log_uses_old_scheme_id?
+
+ field_15 if log_uses_old_scheme_id?
end
def location_field
return :field_17 if log_uses_new_scheme_id?
- return :field_16 if log_uses_old_scheme_id?
+
+ :field_16 if log_uses_old_scheme_id?
end
def location_id
return field_17 if log_uses_new_scheme_id?
- return field_16 if log_uses_old_scheme_id?
+
+ field_16 if log_uses_old_scheme_id?
end
def scheme_or_management_group
@@ -1424,7 +1428,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1488,7 +1493,8 @@ private
def housingneeds_other
return 1 if field_86 == 1
- return 0 if [field_83, field_84, field_85].include?(1)
+
+ 0 if [field_83, field_84, field_85].include?(1)
end
def prevloc
@@ -1555,7 +1561,7 @@ private
end
def earnings
- field_122.round if field_122.present?
+ field_122.presence&.round
end
def tshortfall_known
diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb
index 66d46ead5..1ba683f66 100644
--- a/app/services/bulk_upload/lettings/year2024/row_parser.rb
+++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb
@@ -562,7 +562,7 @@ class BulkUpload::Lettings::Year2024::RowParser
private
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next unless question&.type == "radio"
@@ -1455,7 +1455,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1519,7 +1520,8 @@ private
def housingneeds_other
return 1 if field_82 == 1
- return 0 if [field_79, field_80, field_81].include?(1)
+
+ 0 if [field_79, field_80, field_81].include?(1)
end
def prevloc
@@ -1595,7 +1597,7 @@ private
end
def earnings
- field_119.round if field_119.present?
+ field_119.presence&.round
end
def tshortfall_known
diff --git a/app/services/bulk_upload/lettings/year2025/row_parser.rb b/app/services/bulk_upload/lettings/year2025/row_parser.rb
index ac508f2c2..5d132d3ef 100644
--- a/app/services/bulk_upload/lettings/year2025/row_parser.rb
+++ b/app/services/bulk_upload/lettings/year2025/row_parser.rb
@@ -590,7 +590,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next unless question&.type == "radio"
@@ -1481,7 +1481,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1545,7 +1546,8 @@ private
def housingneeds_other
return 1 if field_82 == 1
- return 0 if [field_79, field_80, field_81].include?(1)
+
+ 0 if [field_79, field_80, field_81].include?(1)
end
def prevloc
@@ -1621,7 +1623,7 @@ private
end
def earnings
- field_119.round if field_119.present?
+ field_119.presence&.round
end
def tshortfall_known
diff --git a/app/services/bulk_upload/lettings/year2026/csv_parser.rb b/app/services/bulk_upload/lettings/year2026/csv_parser.rb
index 3e5933219..d2f1ab7b1 100644
--- a/app/services/bulk_upload/lettings/year2026/csv_parser.rb
+++ b/app/services/bulk_upload/lettings/year2026/csv_parser.rb
@@ -4,7 +4,7 @@ class BulkUpload::Lettings::Year2026::CsvParser
include CollectionTimeHelper
# TODO: CLDC-4162: Update when 2026 format is known
- FIELDS = 153
+ FIELDS = 147
FORM_YEAR = 2026
attr_reader :path
@@ -27,7 +27,7 @@ class BulkUpload::Lettings::Year2026::CsvParser
def cols
# TODO: CLDC-4162: Update when 2026 format is known
- @cols ||= ("A".."EX").to_a
+ @cols ||= ("A".."FA").to_a
end
def row_parsers
diff --git a/app/services/bulk_upload/lettings/year2026/row_parser.rb b/app/services/bulk_upload/lettings/year2026/row_parser.rb
index 6ecf214a6..1bb62f14a 100644
--- a/app/services/bulk_upload/lettings/year2026/row_parser.rb
+++ b/app/services/bulk_upload/lettings/year2026/row_parser.rb
@@ -11,154 +11,147 @@ class BulkUpload::Lettings::Year2026::RowParser
field_4: "What is the needs type?",
field_5: "What scheme does this letting belong to?",
field_6: "Which location is this letting for?",
- field_7: "Is this letting a renewal?",
- field_8: "What is the tenancy start date?",
- field_9: "What is the tenancy start date?",
- field_10: "What is the tenancy start date?",
+ field_7: "Is this letting a renewal of social housing to the same tenant in the same property?",
+ field_8: "What is the tenancy start date? - day DD?",
+ field_9: "What is the tenancy start date? - month MM?",
+ field_10: "What is the tenancy start date? - year YY?",
field_11: "What is the rent type?",
field_12: "Which 'Other' type of Intermediate Rent is this letting?",
field_13: "What is the tenant code?",
field_14: "What is the property reference?",
- field_15: "Has tenant seen the MHCLG privacy notice?",
+ field_15: "Has the tenant seen or been given access to the MHCLG privacy notice?",
field_16: "What is the reason for the property being vacant?",
field_17: "What type was the property most recently let as?",
field_18: "If known, provide this property’s UPRN",
- field_19: "Address line 1",
- field_20: "Address line 2",
+ field_19: "Address Line 1",
+ field_20: "Address Line 2",
field_21: "Town or city",
field_22: "County",
- field_23: "Part 1 of the property’s postcode",
- field_24: "Part 2 of the property’s postcode",
- field_25: "What is the property’s local authority?",
+ field_23: "Part 1 of the property's postcode",
+ field_24: "Part 2 of the property's postcode",
+ field_25: "What is the property's local authority?",
field_26: "What type of unit is the property?",
- field_27: "Which type of building is the property?",
- field_28: "Is the property built or adapted to wheelchair-user standards?",
- field_29: "How many bedrooms does the property have?",
- field_30: "What is the void date?",
- field_31: "What is the void date?",
- field_32: "What is the void date?",
- field_33: "What date were any major repairs completed on?",
- field_34: "What date were any major repairs completed on?",
- field_35: "What date were any major repairs completed on?",
- field_36: "Is this letting sheltered accommodation?",
- field_37: "Is this a joint tenancy?",
- field_38: "Is this a starter tenancy?",
- field_39: "What is the type of tenancy?",
- field_40: "If 'Other', what is the type of tenancy?",
- field_41: "What is the length of the fixed-term tenancy to the nearest year?",
- field_42: "What is the lead tenant’s age?",
- field_43: "Which of these best describes the lead tenant’s gender identity?",
- field_44: "Which of these best describes the lead tenant’s ethnic background?",
- field_45: "What is the lead tenant’s nationality?",
- field_46: "Which of these best describes the lead tenant’s working situation?",
- field_47: "Is person 2 the partner of the lead tenant?",
- field_48: "What is person 2’s age?",
- field_49: "Which of these best describes person 2’s gender identity?",
- field_50: "Which of these best describes person 2’s working situation?",
- field_51: "Is person 3 the partner of the lead tenant?",
- field_52: "What is person 3’s age?",
- field_53: "Which of these best describes person 3’s gender identity?",
- field_54: "Which of these best describes person 3’s working situation?",
- field_55: "Is person 4 the partner of the lead tenant?",
- field_56: "What is person 4’s age?",
- field_57: "Which of these best describes person 4’s gender identity?",
- field_58: "Which of these best describes person 4’s working situation?",
- field_59: "Is person 5 the partner of the lead tenant?",
- field_60: "What is person 5’s age?",
- field_61: "Which of these best describes person 5’s gender identity?",
- field_62: "Which of these best describes person 5’s working situation?",
- field_63: "Is person 6 the partner of the lead tenant?",
- field_64: "What is person 6’s age?",
- field_65: "Which of these best describes person 6’s gender identity?",
- field_66: "Which of these best describes person 6’s working situation?",
- field_67: "Is person 7 the partner of the lead tenant?",
- field_68: "What is person 7’s age?",
- field_69: "Which of these best describes person 7’s gender identity?",
- field_70: "Which of these best describes person 7’s working situation?",
- field_71: "Is person 8 the partner of the lead tenant?",
- field_72: "What is person 8’s age?",
- field_73: "Which of these best describes person 8’s gender identity?",
- field_74: "Which of these best describes person 8’s working situation?",
- field_75: "Does anybody in the household have links to the UK armed forces?",
- field_76: "Is this person still serving in the UK armed forces?",
- field_77: "Was this person seriously injured or ill as a result of serving in the UK armed forces?",
- field_78: "Is anybody in the household pregnant?",
- field_79: "Does anybody in the household have any disabled access needs?",
- field_80: "Does anybody in the household have any disabled access needs?",
- field_81: "Does anybody in the household have any disabled access needs?",
- field_82: "Does anybody in the household have any disabled access needs?",
- field_83: "Does anybody in the household have any disabled access needs?",
- field_84: "Does anybody in the household have any disabled access needs?",
- field_85: "Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?",
- field_86: "Does this person’s condition affect their dexterity?",
- field_87: "Does this person’s condition affect their learning or understanding or concentrating?",
- field_88: "Does this person’s condition affect their hearing?",
- field_89: "Does this person’s condition affect their memory?",
- field_90: "Does this person’s condition affect their mental health?",
- field_91: "Does this person’s condition affect their mobility?",
- field_92: "Does this person’s condition affect them socially or behaviourally?",
- field_93: "Does this person’s condition affect their stamina or breathing or fatigue?",
- field_94: "Does this person’s condition affect their vision?",
- field_95: "Does this person’s condition affect them in another way?",
- field_96: "How long has the household continuously lived in the local authority area of the new letting?",
- field_97: "How long has the household been on the local authority waiting list for the new letting?",
- field_98: "What is the tenant’s main reason for the household leaving their last settled home?",
- field_99: "If 'Other', what was the main reason for leaving their last settled home?",
- field_100: "Where was the household immediately before this letting?",
- field_101: "Did the household experience homelessness immediately before this letting?",
- field_102: "Do you know the postcode of the household’s last settled home?",
- field_103: "What is the postcode of the household’s last settled home?",
- field_104: "What is the postcode of the household’s last settled home?",
- field_105: "What is the local authority of the household’s last settled home?",
- field_106: "Was the household given 'reasonable preference' by the local authority?",
- field_107: "Reasonable preference reason - They were homeless or about to lose their home (within 56 days)",
- field_108: "Reasonable preference reason - They were living in insanitary, overcrowded or unsatisfactory housing",
- field_109: "Reasonable preference reason - They needed to move on medical and welfare reasons (including disability)",
- field_110: "Reasonable preference reason - They needed to move to avoid hardship to themselves or others",
- field_111: "Reasonable preference reason - Don’t know",
- field_112: "Was the letting made under the Choice-Based Lettings (CBL)?",
- field_113: "Was the letting made under the Common Allocation Policy (CAP)?",
- field_114: "Was the letting made under the Common Housing Register (CHR)?",
- field_115: "Was the letting made under the Accessible Register?",
- field_116: "What was the source of referral for this letting?",
- field_117: "Do you know the household’s combined total income after tax?",
- field_118: "How often does the household receive income?",
- field_119: "How much income does the household have in total?",
- field_120: "Is the tenant likely to be receiving any of these housing-related benefits?",
- field_121: "How much of the household’s income is from Universal Credit, state pensions or benefits?",
- field_122: "Does the household pay rent or other charges for the accommodation?",
- field_123: "How often does the household pay rent and other charges?",
- field_124: "What is the basic rent?",
- field_125: "What is the service charge?",
- field_126: "What is the personal service charge?",
- field_127: "What is the support charge?",
- field_128: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?",
- field_129: "What do you expect the outstanding amount to be?",
-
- field_130: "Lead tenant's sex, as registered at birth",
- field_131: "Person 2's sex, as registered at birth",
- field_132: "Person 3's sex, as registered at birth",
- field_133: "Person 4's sex, as registered at birth",
- field_134: "Person 5's sex, as registered at birth",
- field_135: "Person 6's sex, as registered at birth",
- field_136: "Person 7's sex, as registered at birth",
- field_137: "Person 8's sex, as registered at birth",
- field_138: "Is the gender the lead tenant identifies with the same as their sex registered at birth?",
- field_139: "If 'No', enter the lead tenant's gender identity",
- field_140: "Is the gender person 2 identifies with the same as their sex registered at birth?",
- field_141: "If 'No', enter person 2's gender identity",
- field_142: "Is the gender person 3 identifies with the same as their sex registered at birth?",
- field_143: "If 'No', enter person 3's gender identity",
- field_144: "Is the gender person 4 identifies with the same as their sex registered at birth?",
- field_145: "If 'No', enter person 4's gender identity",
- field_146: "Is the gender person 5 identifies with the same as their sex registered at birth?",
- field_147: "If 'No', enter person 5's gender identity",
- field_148: "Is the gender person 6 identifies with the same as their sex registered at birth?",
- field_149: "If 'No', enter person 6's gender identity",
- field_150: "Is the gender person 7 identifies with the same as their sex registered at birth?",
- field_151: "If 'No', enter person 7's gender identity",
- field_152: "Is the gender person 8 identifies with the same as their sex registered at birth?",
- field_153: "If 'No', enter person 8's gender identity",
+ field_27: "Is the property built or adapted to wheelchair-user standards?",
+ field_28: "How many bedrooms does the property have?",
+ field_29: "What is the void date? - day DD",
+ field_30: "What is the void date? - month MM",
+ field_31: "What is the void date? - year YY",
+ field_32: "What date were any major repairs completed on? - day DD",
+ field_33: "What date were any major repairs completed on? - month MM",
+ field_34: "What date were any major repairs completed on? - year YY",
+ field_35: "Is this property older people's housing?",
+ field_36: "Is this a joint tenancy?",
+ field_37: "Is this a starter tenancy?",
+ field_38: "What is the type of tenancy?",
+ field_39: "If 'Other', what is the type of tenancy?",
+ field_40: "What is the length of the fixed-term tenancy to the nearest year?",
+ field_41: "What is the lead tenant’s age?",
+ field_42: "What is the lead tenant's sex?",
+ field_43: "Is the gender the lead tenant identifies with the same as their sex registered at birth?",
+ field_44: "If 'No', enter lead tenant's gender identity",
+ field_45: "Which of these best describes the lead tenant's ethnic background?",
+ field_46: "What is the lead tenant’s nationality?",
+ field_47: "Which of these best describes the lead tenant’s working situation?",
+ field_48: "What is person 2's age?",
+ field_49: "Is person 2 the partner of the lead tenant?",
+ field_50: "What is person 2's sex?",
+ field_51: "Is the gender the person 2 identifies with the same as their sex registered at birth?",
+ field_52: "If 'No', enter person 2's gender identity",
+ field_53: "Which of these best describes person 2's working situation?",
+ field_54: "What is person 3's age?",
+ field_55: "Is person 3 the partner of the lead tenant?",
+ field_56: "What is person 3's sex?",
+ field_57: "Is the gender the person 3 identifies with the same as their sex registered at birth?",
+ field_58: "If 'No', enter person 3's gender identity",
+ field_59: "Which of these best describes person 3's working situation?",
+ field_60: "What is person 4's age?",
+ field_61: "Is person 4 the partner of the lead tenant?",
+ field_62: "What is person 4's sex?",
+ field_63: "Is the gender the person 4 identifies with the same as their sex registered at birth?",
+ field_64: "If 'No', enter person 4's gender identity",
+ field_65: "Which of these best describes person 4's working situation?",
+ field_66: "What is person 5's age?",
+ field_67: "Is person 5 the partner of the lead tenant?",
+ field_68: "What is person 5's sex?",
+ field_69: "Is the gender the person 5 identifies with the same as their sex registered at birth?",
+ field_70: "If 'No', enter person 5's gender identity",
+ field_71: "Which of these best describes person 5's working situation?",
+ field_72: "What is person 6's age?",
+ field_73: "Is person 6 the partner of the lead tenant?",
+ field_74: "What is person 6's sex?",
+ field_75: "Is the gender the person 6 identifies with the same as their sex registered at birth?",
+ field_76: "If 'No', enter person 6's gender identity",
+ field_77: "Which of these best describes person 6's working situation?",
+ field_78: "What is person 7's age?",
+ field_79: "Is person 7 the partner of the lead tenant?",
+ field_80: "What is person 7's sex?",
+ field_81: "Is the gender the person 7 identifies with the same as their sex registered at birth?",
+ field_82: "If 'No', enter person 7's gender identity",
+ field_83: "Which of these best describes person 7's working situation?",
+ field_84: "What is person 8's age?",
+ field_85: "Is person 8 the partner of the lead tenant?",
+ field_86: "What is person 8's sex?",
+ field_87: "Is the gender the person 8 identifies with the same as their sex registered at birth?",
+ field_88: "If 'No', enter person 8's gender identity",
+ field_89: "Which of these best describes person 8's working situation?",
+ field_90: "Does anybody in the household have links to the UK armed forces?",
+ field_91: "Is this person still serving in the UK armed forces?",
+ field_92: "Was this person seriously injured or ill as a result of serving in the UK armed forces?",
+ field_93: "Is anybody in the household pregnant?",
+ field_94: "Disabled access needs — a) Fully wheelchair-accessible housing",
+ field_95: "Disabled access needs — b) Wheelchair access to essential rooms",
+ field_96: "Disabled access needs — c) Level access housing",
+ field_97: "Disabled access needs — f) Other disabled access needs",
+ field_98: "Disabled access needs — g) No disabled access needs",
+ field_99: "Disabled access needs — h) Don’t know",
+ field_100: "Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?",
+ field_101: "Does this person's condition affect their dexterity?",
+ field_102: "Does this person's condition affect their learning or understanding or concentrating?",
+ field_103: "Does this person's condition affect their hearing?",
+ field_104: "Does this person's condition affect their memory?",
+ field_105: "Does this person's condition affect their mental health?",
+ field_106: "Does this person's condition affect their mobility?",
+ field_107: "Does this person's condition affect them socially or behaviourally?",
+ field_108: "Does this person's condition affect their stamina or breathing or fatigue?",
+ field_109: "Does this person's condition affect their vision?",
+ field_110: "Does this person's condition affect them in another way?",
+ field_111: "How long has the household continuously lived in the local authority area of the new letting?",
+ field_112: "How long has the household been on the local authority housing register (or waiting list) for the area of the new letting?",
+ field_113: "What is the tenant’s main reason for the household leaving their last settled home?",
+ field_114: "If 'Other', what was the main reason for leaving their last settled home?",
+ field_115: "Where was the household immediately before this letting?",
+ field_116: "Did the household experience homelessness immediately before this letting?",
+ field_117: "Do you know the postcode of the household's last settled home?",
+ field_118: "Part 1 of postcode of last settled home",
+ field_119: "Part 2 of postcode of last settled home",
+ field_120: "What is the local authority of the household's last settled home?",
+ field_121: "Was the household given 'reasonable preference' by the local authority?",
+ field_122: "Reasonable preference reason — They were homeless or about to lose their home (within 56 days)",
+ field_123: "Reasonable preference reason — They were living in unsanitary, overcrowded or unsatisfactory housing",
+ field_124: "Reasonable preference reason — They needed to move due to medical and welfare reasons (including disability)",
+ field_125: "Reasonable preference reason — They needed to move to avoid hardship to themselves or others",
+ field_126: "Reasonable preference reason — Don't know",
+ field_127: "How was this letting allocated? — Choice based Lettings (CBL)",
+ field_128: "How was this letting allocated? — Common Allocations Policy (CAP)",
+ field_129: "How was this letting allocated? — Common Housing Register (CHR)",
+ field_130: "How was this letting allocated? — Accessible Housing Register",
+ field_131: "What was the source of referral for this letting? - LA properties",
+ field_132: "What was the source of referral for this letting? - PRP properties part 1",
+ field_133: "What was the source of referral for this letting? - PRP properties part 2",
+ field_134: "What was the source of referral for this letting? - PRP properties part 3",
+ field_135: "Do you know the household's combined total income after tax?",
+ field_136: "How often does the household receive income?",
+ field_137: "How much income does the household have in total?",
+ field_138: "Is the tenant likely to be receiving any of these housing-related benefits?",
+ field_139: "How much of the household's income is from Universal Credit, state pensions or benefits?",
+ field_140: "Does the household pay rent or other charges for the accommodation?",
+ field_141: "How often does the household pay rent and other charges?",
+ field_142: "What is the basic rent?",
+ field_143: "What is the service charge?",
+ field_144: "What is the personal service charge?",
+ field_145: "What is the support charge?",
+ field_146: "After the household has received any housing-related benefits, will they still need to pay for rent and charges?",
+ field_147: "What do you expect the outstanding amount to be?",
}.freeze
RENT_TYPE_BU_MAPPING = {
@@ -174,23 +167,23 @@ class BulkUpload::Lettings::Year2026::RowParser
ERROR_BASE_KEY = "validations.lettings.2026.bulk_upload".freeze
CASE_INSENSITIVE_FIELDS = [
- :field_42, # What is the lead tenant’s age?
- :field_48, # What is person 2’s age?
- :field_52, # What is person 3’s age?
- :field_56, # What is person 4’s age?
- :field_60, # What is person 5’s age?
- :field_64, # What is person 6’s age?
- :field_68, # What is person 7’s age?
- :field_72, # What is person 8’s age?
-
- :field_130, # What is the lead tenant's sex?
- :field_131, # What is person 2's sex?
- :field_132, # What is person 3's sex?
- :field_133, # What is person 4's sex?
- :field_134, # What is person 5's sex?
- :field_135, # What is person 6's sex?
- :field_136, # What is person 7's sex?
- :field_137, # What is person 8's sex?
+ :field_41, # What is the lead tenant's age?
+ :field_48, # What is person 2's age?
+ :field_54, # What is person 3's age?
+ :field_60, # What is person 4's age?
+ :field_66, # What is person 5's age?
+ :field_72, # What is person 6's age?
+ :field_78, # What is person 7's age?
+ :field_84, # What is person 8's age?
+
+ :field_42, # What is the lead tenant's sex?
+ :field_50, # What is person 2's sex?
+ :field_56, # What is person 3's sex?
+ :field_62, # What is person 4's sex?
+ :field_68, # What is person 5's sex?
+ :field_74, # What is person 6's sex?
+ :field_80, # What is person 7's sex?
+ :field_86, # What is person 8's sex?
].freeze
attribute :bulk_upload
@@ -202,6 +195,8 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_2, :string
attribute :field_3, :string
attribute :field_4, :integer
+ attribute :field_5, :string
+ attribute :field_6, :string
attribute :field_7, :integer
attribute :field_8, :integer
attribute :field_9, :integer
@@ -210,8 +205,9 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_12, :string
attribute :field_13, :string
attribute :field_14, :string
- attribute :field_5, :string
- attribute :field_6, :string
+ attribute :field_15, :integer
+ attribute :field_16, :integer
+ attribute :field_17, :integer
attribute :field_18, :string
attribute :field_19, :string
attribute :field_20, :string
@@ -220,8 +216,6 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_23, :string
attribute :field_24, :string
attribute :field_25, :string
- attribute :field_17, :integer
- attribute :field_16, :integer
attribute :field_26, :integer
attribute :field_27, :integer
attribute :field_28, :integer
@@ -232,60 +226,59 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_33, :integer
attribute :field_34, :integer
attribute :field_35, :integer
+ attribute :field_36, :integer
attribute :field_37, :integer
attribute :field_38, :integer
- attribute :field_39, :integer
- attribute :field_40, :string
- attribute :field_41, :integer
- attribute :field_36, :integer
- attribute :field_15, :integer
+ attribute :field_39, :string
+ attribute :field_40, :integer
+ attribute :field_41, :string
attribute :field_42, :string
attribute :field_43, :string
- attribute :field_44, :integer
+ attribute :field_44, :string
attribute :field_45, :integer
attribute :field_46, :integer
attribute :field_47, :integer
attribute :field_48, :string
- attribute :field_49, :string
- attribute :field_50, :integer
- attribute :field_51, :integer
+ attribute :field_49, :integer
+ attribute :field_50, :string
+ attribute :field_51, :string
attribute :field_52, :string
- attribute :field_53, :string
- attribute :field_54, :integer
+ attribute :field_53, :integer
+ attribute :field_54, :string
attribute :field_55, :integer
attribute :field_56, :string
attribute :field_57, :string
- attribute :field_58, :integer
+ attribute :field_58, :string
attribute :field_59, :integer
attribute :field_60, :string
- attribute :field_61, :string
- attribute :field_62, :integer
- attribute :field_63, :integer
+ attribute :field_61, :integer
+ attribute :field_62, :string
+ attribute :field_63, :string
attribute :field_64, :string
- attribute :field_65, :string
- attribute :field_66, :integer
+ attribute :field_65, :integer
+ attribute :field_66, :string
attribute :field_67, :integer
attribute :field_68, :string
- attribute :field_69, :string
- attribute :field_70, :integer
+ attribute :field_69, :integer
+ attribute :field_70, :string
attribute :field_71, :integer
attribute :field_72, :string
- attribute :field_73, :string
- attribute :field_74, :integer
+ attribute :field_73, :integer
+ attribute :field_74, :string
attribute :field_75, :integer
- attribute :field_76, :integer
+ attribute :field_76, :string
attribute :field_77, :integer
- attribute :field_78, :integer
+ attribute :field_78, :string
attribute :field_79, :integer
- attribute :field_80, :integer
+ attribute :field_80, :string
attribute :field_81, :integer
- attribute :field_82, :integer
+ attribute :field_82, :string
attribute :field_83, :integer
- attribute :field_84, :integer
+ attribute :field_84, :string
attribute :field_85, :integer
- attribute :field_86, :integer
+ attribute :field_86, :string
attribute :field_87, :integer
- attribute :field_88, :integer
+ attribute :field_88, :string
attribute :field_89, :integer
attribute :field_90, :integer
attribute :field_91, :integer
@@ -296,13 +289,13 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_96, :integer
attribute :field_97, :integer
attribute :field_98, :integer
- attribute :field_99, :string
+ attribute :field_99, :integer
attribute :field_100, :integer
attribute :field_101, :integer
attribute :field_102, :integer
- attribute :field_103, :string
- attribute :field_104, :string
- attribute :field_105, :string
+ attribute :field_103, :integer
+ attribute :field_104, :integer
+ attribute :field_105, :integer
attribute :field_106, :integer
attribute :field_107, :integer
attribute :field_108, :integer
@@ -311,47 +304,40 @@ class BulkUpload::Lettings::Year2026::RowParser
attribute :field_111, :integer
attribute :field_112, :integer
attribute :field_113, :integer
- attribute :field_114, :integer
+ attribute :field_114, :string
attribute :field_115, :integer
attribute :field_116, :integer
attribute :field_117, :integer
- attribute :field_118, :integer
- attribute :field_119, :decimal
- attribute :field_120, :integer
+ attribute :field_118, :string
+ attribute :field_119, :string
+ attribute :field_120, :string
attribute :field_121, :integer
attribute :field_122, :integer
attribute :field_123, :integer
- attribute :field_124, :decimal
- attribute :field_125, :decimal
- attribute :field_126, :decimal
- attribute :field_127, :decimal
+ attribute :field_124, :integer
+ attribute :field_125, :integer
+ attribute :field_126, :integer
+ attribute :field_127, :integer
attribute :field_128, :integer
- attribute :field_129, :decimal
-
- attribute :field_130, :string
- attribute :field_131, :string
- attribute :field_132, :string
- attribute :field_133, :string
- attribute :field_134, :string
- attribute :field_135, :string
- attribute :field_136, :string
- attribute :field_137, :string
+ attribute :field_129, :integer
+ attribute :field_130, :integer
+ attribute :field_131, :integer
+ attribute :field_132, :integer
+ attribute :field_133, :integer
+ attribute :field_134, :integer
+ attribute :field_135, :integer
+ attribute :field_136, :integer
+ attribute :field_137, :decimal
attribute :field_138, :integer
- attribute :field_139, :string
+ attribute :field_139, :integer
attribute :field_140, :integer
- attribute :field_141, :string
- attribute :field_142, :integer
- attribute :field_143, :string
- attribute :field_144, :integer
- attribute :field_145, :string
+ attribute :field_141, :integer
+ attribute :field_142, :decimal
+ attribute :field_143, :decimal
+ attribute :field_144, :decimal
+ attribute :field_145, :decimal
attribute :field_146, :integer
- attribute :field_147, :string
- attribute :field_148, :integer
- attribute :field_149, :string
- attribute :field_150, :integer
- attribute :field_151, :string
- attribute :field_152, :integer
- attribute :field_153, :string
+ attribute :field_147, :decimal
validate :validate_valid_radio_option, on: :before_log
@@ -418,7 +404,7 @@ class BulkUpload::Lettings::Year2026::RowParser
},
on: :after_log
- validates :field_112,
+ validates :field_127,
presence: {
message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Choice-Based Lettings (CBL)?"),
category: :not_answered,
@@ -426,11 +412,11 @@ class BulkUpload::Lettings::Year2026::RowParser
inclusion: {
in: [1, 2],
message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Choice-Based Lettings (CBL)?"),
- if: -> { field_112.present? },
+ if: -> { field_127.present? },
},
on: :after_log
- validates :field_113,
+ validates :field_128,
presence: {
message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Allocation Policy (CAP)?"),
category: :not_answered,
@@ -438,11 +424,11 @@ class BulkUpload::Lettings::Year2026::RowParser
inclusion: {
in: [1, 2],
message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Allocation Policy (CAP)?"),
- if: -> { field_113.present? },
+ if: -> { field_128.present? },
},
on: :after_log
- validates :field_114,
+ validates :field_129,
presence: {
message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Common Housing Register (CHR)?"),
category: :not_answered,
@@ -450,11 +436,11 @@ class BulkUpload::Lettings::Year2026::RowParser
inclusion: {
in: [1, 2],
message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Common Housing Register (CHR)?"),
- if: -> { field_114.present? },
+ if: -> { field_129.present? },
},
on: :after_log
- validates :field_115,
+ validates :field_130,
presence: {
message: I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "was the letting made under the Accessible Register?"),
category: :not_answered,
@@ -462,24 +448,22 @@ class BulkUpload::Lettings::Year2026::RowParser
inclusion: {
in: [1, 2],
message: I18n.t("#{ERROR_BASE_KEY}.invalid_option", question: "was the letting made under the Accessible Register?"),
- if: -> { field_115.present? },
+ if: -> { field_130.present? },
},
on: :after_log
- validates :field_42, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log
+ validates :field_41, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 1) }, on: :after_log
validates :field_48, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 2) }, on: :after_log, if: proc { details_known?(2).zero? }
- validates :field_52, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? }
- validates :field_56, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? }
- validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? }
- validates :field_64, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? }
- validates :field_68, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? }
- validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? }
+ validates :field_54, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 3) }, on: :after_log, if: proc { details_known?(3).zero? }
+ validates :field_60, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 4) }, on: :after_log, if: proc { details_known?(4).zero? }
+ validates :field_66, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 5) }, on: :after_log, if: proc { details_known?(5).zero? }
+ validates :field_72, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 6) }, on: :after_log, if: proc { details_known?(6).zero? }
+ validates :field_78, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 7) }, on: :after_log, if: proc { details_known?(7).zero? }
+ validates :field_84, format: { with: /\A\d{1,3}\z|\AR\z/, message: I18n.t("#{ERROR_BASE_KEY}.age.invalid", person_num: 8) }, on: :after_log, if: proc { details_known?(8).zero? }
validate :validate_needs_type_present, on: :after_log
validate :validate_data_types, on: :after_log
validate :validate_relevant_collection_window, on: :after_log
- validate :validate_la_with_local_housing_referral, on: :after_log
- validate :validate_cannot_be_la_referral_if_general_needs_and_la, on: :after_log
validate :validate_leaving_reason_for_renewal, on: :after_log
validate :validate_only_one_housing_needs_type, on: :after_log
validate :validate_no_disabled_needs_conjunction, on: :after_log
@@ -490,6 +474,7 @@ class BulkUpload::Lettings::Year2026::RowParser
validate :validate_reasonable_preference_dont_know, on: :after_log
validate :validate_condition_effects, on: :after_log
validate :validate_if_log_already_exists, on: :after_log, if: -> { FeatureToggle.bulk_upload_duplicate_log_check_enabled? }
+ validate :validate_referral_fields, on: :after_log
validate :validate_owning_org_data_given, on: :after_log
validate :validate_owning_org_exists, on: :after_log
@@ -611,13 +596,12 @@ class BulkUpload::Lettings::Year2026::RowParser
!general_needs? ? :field_6.to_s : nil, # location # TODO: CLDC-4119: remove location from hash
!supported_housing? ? "field_23" : nil, # postcode # TODO: CLDC-4119: add postcode to hash for supported housing
!supported_housing? ? "field_24" : nil, # postcode # TODO: CLDC-4119: add postcode to hash for supported housing
- "field_42", # age1
- "field_43", # sex1
- "field_130", # sexrab1
- "field_46", # ecstat1
+ "field_41", # age1
+ "field_42", # sexrab1
+ "field_47", # ecstat1
)
- if [field_124, field_125, field_126, field_127].all?(&:present?)
- hash.merge({ "tcharge" => [field_124, field_125, field_126, field_127].sum })
+ if [field_142, field_143, field_144, field_145].all?(&:present?)
+ hash.merge({ "tcharge" => [field_142, field_143, field_144, field_145].sum })
else
hash
end
@@ -626,7 +610,7 @@ class BulkUpload::Lettings::Year2026::RowParser
def add_duplicate_found_in_spreadsheet_errors
spreadsheet_duplicate_hash.each_key do |field|
if field == "tcharge"
- %w[field_124 field_125 field_126 field_127].each do |sub_field|
+ %w[field_142 field_143 field_144 field_145].each do |sub_field|
errors.add(sub_field, I18n.t("#{ERROR_BASE_KEY}.spreadsheet_dupe"), category: :setup)
end
else
@@ -645,7 +629,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next unless question&.type == "radio"
@@ -742,14 +726,14 @@ private
end
def validate_nationality
- if field_45.present? && !valid_nationality_options.include?(field_45.to_s)
- errors.add(:field_45, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid"))
+ if field_46.present? && !valid_nationality_options.include?(field_46.to_s)
+ errors.add(:field_46, I18n.t("#{ERROR_BASE_KEY}.nationality.invalid"))
end
end
def validate_reasonpref_reason_values
valid_reasonpref_reason_options = %w[0 1]
- %w[field_107 field_108 field_109 field_110 field_111].each do |field|
+ %w[field_122 field_123 field_124 field_125 field_126].each do |field|
next unless send(field).present? && !valid_reasonpref_reason_options.include?(send(field).to_s)
question_text = QUESTIONS[field.to_sym]
@@ -759,10 +743,10 @@ private
end
def validate_prevten_value_when_renewal
- return unless field_7 == 1
- return if field_100.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_100)
+ return unless renewal?
+ return if field_115.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_115)
- errors.add(:field_100, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid"))
+ errors.add(:field_115, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid"))
end
def duplicate_check_fields
@@ -770,7 +754,6 @@ private
"startdate",
"age1",
"sexrab1",
- "sex1",
"ecstat1",
"owning_organisation",
"tcharge",
@@ -788,41 +771,41 @@ private
end
def validate_no_and_dont_know_disabled_needs_conjunction
- if field_83 == 1 && field_84 == 1
- errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
- errors.add(:field_84, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
+ if field_98 == 1 && field_99 == 1
+ errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
+ errors.add(:field_99, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_and_dont_know_disabled_needs_conjunction"))
end
end
def validate_dont_know_disabled_needs_conjunction
- if field_84 == 1 && [field_79, field_80, field_81, field_82].count(1).positive?
- %i[field_84 field_79 field_80 field_81 field_82].each do |field|
+ if field_99 == 1 && [field_94, field_95, field_96, field_97].count(1).positive?
+ %i[field_99 field_94 field_95 field_96 field_97].each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.dont_know_disabled_needs_conjunction")) if send(field) == 1
end
end
end
def validate_no_disabled_needs_conjunction
- if field_83 == 1 && [field_79, field_80, field_81, field_82].count(1).positive?
- %i[field_83 field_79 field_80 field_81 field_82].each do |field|
+ if field_98 == 1 && [field_94, field_95, field_96, field_97].count(1).positive?
+ %i[field_98 field_94 field_95 field_96 field_97].each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds.no_disabled_needs_conjunction")) if send(field) == 1
end
end
end
def validate_only_one_housing_needs_type
- if [field_79, field_80, field_81].count(1) > 1
- %i[field_79 field_80 field_81].each do |field|
+ if [field_94, field_95, field_96].count(1) > 1
+ %i[field_94 field_95 field_96].each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.housingneeds_type.only_one_option_permitted")) if send(field) == 1
end
end
end
def validate_no_housing_needs_questions_answered
- if [field_79, field_80, field_81, field_82, field_83, field_84].all?(&:blank?)
- errors.add(:field_83, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs."))
- errors.add(:field_82, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs."))
- %i[field_79 field_80 field_81].each do |field|
+ if [field_94, field_95, field_96, field_97, field_98, field_99].all?(&:blank?)
+ errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "anybody with disabled access needs."))
+ errors.add(:field_97, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "other access needs."))
+ %i[field_94 field_95 field_96].each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "disabled access needs type."))
end
end
@@ -830,16 +813,16 @@ private
def validate_reasonable_preference_dont_know
if rp_dontknow_conflict?
- errors.add(:field_111, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know"))
- %i[field_107 field_108 field_109 field_110].each do |field|
+ errors.add(:field_126, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.dont_know"))
+ %i[field_122 field_123 field_124 field_125].each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.reasonpref.conflict.other")) if send(field) == 1
end
end
end
def validate_reasonable_preference_homeless
- reason_fields = %i[field_107 field_108 field_109 field_110 field_111]
- if field_106 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? }
+ reason_fields = %i[field_122 field_123 field_124 field_125 field_126]
+ if field_121 == 1 && reason_fields.all? { |field| attributes[field.to_s].blank? }
reason_fields.each do |field|
errors.add(field, I18n.t("#{ERROR_BASE_KEY}.not_answered", question: "reason for reasonable preference."))
end
@@ -847,7 +830,7 @@ private
end
def validate_condition_effects
- illness_option_fields = %i[field_94 field_88 field_91 field_86 field_87 field_89 field_90 field_93 field_92 field_95]
+ illness_option_fields = %i[field_109 field_103 field_106 field_101 field_102 field_104 field_105 field_108 field_107 field_110]
if household_no_illness?
illness_option_fields.each do |field|
if attributes[field.to_s] == 1
@@ -862,12 +845,12 @@ private
end
def household_no_illness?
- field_85 != 1
+ field_100 != 1
end
def validate_leaving_reason_for_renewal
- if field_7 == 1 && ![50, 51, 52, 53].include?(field_98)
- errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed"))
+ if renewal? && ![50, 51, 52, 53].include?(field_113)
+ errors.add(:field_113, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed"))
end
end
@@ -879,16 +862,8 @@ private
field_4 == 2
end
- def validate_cannot_be_la_referral_if_general_needs_and_la
- if field_116 == 4 && general_needs? && owning_organisation && owning_organisation.la?
- errors.add :field_116, I18n.t("#{ERROR_BASE_KEY}.referral.general_needs_prp_referred_by_la")
- end
- end
-
- def validate_la_with_local_housing_referral
- if field_116 == 3 && owning_organisation && owning_organisation.la?
- errors.add(:field_116, I18n.t("#{ERROR_BASE_KEY}.referral.nominated_by_local_ha_but_la"))
- end
+ def renewal?
+ field_7 == 1
end
def validate_relevant_collection_window
@@ -1016,13 +991,13 @@ private
end
def validate_all_charges_given
- return if supported_housing? && field_124 == 1
+ return if supported_housing? && field_142 == 1
blank_charge_fields, other_charge_fields = {
- field_124: "basic rent",
- field_125: "service charge",
- field_126: "personal service charge",
- field_127: "support charge",
+ field_142: "basic rent",
+ field_143: "service charge",
+ field_144: "personal service charge",
+ field_145: "support charge",
}.partition { |field, _| public_send(field).blank? }.map(&:to_h)
blank_charge_fields.each do |field, charge|
@@ -1038,7 +1013,7 @@ private
end
def all_charges_given?
- field_124.present? && field_125.present? && field_126.present? && field_127.present?
+ field_142.present? && field_143.present? && field_144.present? && field_145.present?
end
def setup_question?(question)
@@ -1059,15 +1034,65 @@ private
errors.add(:field_23, error_message) unless supported_housing? # postcode_full # TODO: CLDC-4119: add postcode to error fields for supported housing
errors.add(:field_24, error_message) unless supported_housing? # postcode_full # TODO: CLDC-4119: add postcode to error fields for supported housing
errors.add(:field_25, error_message) unless supported_housing? # la # TODO: CLDC-4119: add LA to error fields for supported housing
- errors.add(:field_42, error_message) # age1
- errors.add(:field_130, error_message) # sexrab1
- errors.add(:field_43, error_message) # sex1
- errors.add(:field_46, error_message) # ecstat1
- errors.add(:field_122, error_message) unless general_needs? # household_charge
- errors.add(:field_124, error_message) # brent
- errors.add(:field_125, error_message) # scharge
- errors.add(:field_126, error_message) # pscharge
- errors.add(:field_127, error_message) # chcharge
+ errors.add(:field_41, error_message) # age1
+ errors.add(:field_42, error_message) # sexrab1
+ errors.add(:field_47, error_message) # ecstat1
+ errors.add(:field_140, error_message) unless general_needs? # household_charge
+ errors.add(:field_142, error_message) # brent
+ errors.add(:field_143, error_message) # scharge
+ errors.add(:field_144, error_message) # pscharge
+ errors.add(:field_145, error_message) # chcharge
+ end
+ end
+
+ def field_referral_register_la_valid?
+ if owning_organisation&.la?
+ [1, 2, 3, 4].include?(field_131)
+ else
+ field_131.blank?
+ end
+ end
+
+ def field_referral_register_prp_valid?
+ if owning_organisation&.prp?
+ [5, 6, 7, 8, 9].include?(field_132)
+ else
+ field_132.blank?
+ end
+ end
+
+ def field_referral_noms_valid?
+ case field_132
+ when 6
+ [1, 2, 3, 4].include?(field_133)
+ when 7
+ [5, 6, 7, 8].include?(field_133)
+ else
+ field_133.blank?
+ end
+ end
+
+ def field_referral_org_valid?
+ case field_133
+ when 1
+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].include?(field_134)
+ when 7
+ [11, 12, 13, 14, 15, 16, 17, 18, 19, 20].include?(field_134)
+ else
+ field_134.blank?
+ end
+ end
+
+ def referral_fields_valid?
+ field_referral_register_la_valid? && field_referral_register_prp_valid? && field_referral_noms_valid? && field_referral_org_valid?
+ end
+
+ def validate_referral_fields
+ return if renewal?
+ return if referral_fields_valid?
+
+ %i[field_131 field_132 field_133 field_134].each do |field|
+ errors.add(field, I18n.t("#{ERROR_BASE_KEY}.referral.invalid_option"))
end
end
@@ -1092,139 +1117,139 @@ private
rent_type: %i[field_11],
startdate: %i[field_8 field_9 field_10],
unittype_gn: %i[field_26],
- builtype: %i[field_27],
- wchair: %i[field_28],
- beds: %i[field_29],
- joint: %i[field_37],
- startertenancy: %i[field_38],
- tenancy: %i[field_39],
- tenancyother: %i[field_40],
- tenancylength: %i[field_41],
+ wchair: %i[field_27],
+ beds: %i[field_28],
+ joint: %i[field_36],
+ startertenancy: %i[field_37],
+ tenancy: %i[field_38],
+ tenancyother: %i[field_39],
+ tenancylength: %i[field_40],
declaration: %i[field_15],
- age1_known: %i[field_42],
- age1: %i[field_42],
+ age1_known: %i[field_41],
+ age1: %i[field_41],
age2_known: %i[field_48],
age2: %i[field_48],
- age3_known: %i[field_52],
- age3: %i[field_52],
- age4_known: %i[field_56],
- age4: %i[field_56],
- age5_known: %i[field_60],
- age5: %i[field_60],
- age6_known: %i[field_64],
- age6: %i[field_64],
- age7_known: %i[field_68],
- age7: %i[field_68],
- age8_known: %i[field_72],
- age8: %i[field_72],
-
- sex1: %i[field_43],
- sex2: %i[field_49],
- sex3: %i[field_53],
- sex4: %i[field_57],
- sex5: %i[field_61],
- sex6: %i[field_65],
- sex7: %i[field_69],
- sex8: %i[field_73],
-
- ethnic_group: %i[field_44],
- ethnic: %i[field_44],
- nationality_all: %i[field_45],
- nationality_all_group: %i[field_45],
-
- relat2: %i[field_47],
- relat3: %i[field_51],
- relat4: %i[field_55],
- relat5: %i[field_59],
- relat6: %i[field_63],
- relat7: %i[field_67],
- relat8: %i[field_71],
-
- ecstat1: %i[field_46],
- ecstat2: %i[field_50],
- ecstat3: %i[field_54],
- ecstat4: %i[field_58],
- ecstat5: %i[field_62],
- ecstat6: %i[field_66],
- ecstat7: %i[field_70],
- ecstat8: %i[field_74],
-
- armedforces: %i[field_75],
- leftreg: %i[field_76],
- reservist: %i[field_77],
- preg_occ: %i[field_78],
- housingneeds: %i[field_78],
-
- illness: %i[field_85],
-
- layear: %i[field_96],
- waityear: %i[field_97],
- reason: %i[field_98],
- reasonother: %i[field_99],
- prevten: %i[field_100],
- homeless: %i[field_101],
-
- prevloc: %i[field_105],
- previous_la_known: %i[field_105],
- ppcodenk: %i[field_102],
- ppostcode_full: %i[field_103 field_104],
-
- reasonpref: %i[field_106],
- rp_homeless: %i[field_107],
- rp_insan_unsat: %i[field_108],
- rp_medwel: %i[field_109],
- rp_hardship: %i[field_110],
- rp_dontknow: %i[field_111],
-
- cbl: %i[field_112],
- cap: %i[field_113],
- chr: %i[field_114],
- accessible_register: %i[field_115],
- letting_allocation: %i[field_112 field_113 field_114 field_115],
-
- referral_type: %i[field_116],
- referral: %i[field_116],
-
- net_income_known: %i[field_117],
- incfreq: %i[field_118],
- earnings: %i[field_119],
- hb: %i[field_120],
- benefits: %i[field_121],
-
- period: %i[field_123],
- brent: %i[field_124],
- scharge: %i[field_125],
- pscharge: %i[field_126],
- supcharg: %i[field_127],
- tcharge: %i[field_124 field_125 field_126 field_127],
- household_charge: %i[field_122],
- hbrentshortfall: %i[field_128],
- tshortfall: %i[field_129],
+ age3_known: %i[field_54],
+ age3: %i[field_54],
+ age4_known: %i[field_60],
+ age4: %i[field_60],
+ age5_known: %i[field_66],
+ age5: %i[field_66],
+ age6_known: %i[field_72],
+ age6: %i[field_72],
+ age7_known: %i[field_78],
+ age7: %i[field_78],
+ age8_known: %i[field_84],
+ age8: %i[field_84],
+
+ sexrab1: %i[field_42],
+ sexrab2: %i[field_50],
+ sexrab3: %i[field_56],
+ sexrab4: %i[field_62],
+ sexrab5: %i[field_68],
+ sexrab6: %i[field_74],
+ sexrab7: %i[field_80],
+ sexrab8: %i[field_86],
+
+ ethnic_group: %i[field_45],
+ ethnic: %i[field_45],
+ nationality_all: %i[field_46],
+ nationality_all_group: %i[field_46],
+
+ relat2: %i[field_49],
+ relat3: %i[field_55],
+ relat4: %i[field_61],
+ relat5: %i[field_67],
+ relat6: %i[field_73],
+ relat7: %i[field_79],
+ relat8: %i[field_85],
+
+ ecstat1: %i[field_47],
+ ecstat2: %i[field_53],
+ ecstat3: %i[field_59],
+ ecstat4: %i[field_65],
+ ecstat5: %i[field_71],
+ ecstat6: %i[field_77],
+ ecstat7: %i[field_83],
+ ecstat8: %i[field_89],
+
+ armedforces: %i[field_90],
+ leftreg: %i[field_91],
+ reservist: %i[field_92],
+ preg_occ: %i[field_93],
+ housingneeds: %i[field_93],
+
+ illness: %i[field_100],
+
+ layear: %i[field_111],
+ waityear: %i[field_112],
+ reason: %i[field_113],
+ reasonother: %i[field_114],
+ prevten: %i[field_115],
+ homeless: %i[field_116],
+
+ prevloc: %i[field_120],
+ previous_la_known: %i[field_120],
+ ppcodenk: %i[field_117],
+ ppostcode_full: %i[field_118 field_119],
+
+ reasonpref: %i[field_121],
+ rp_homeless: %i[field_122],
+ rp_insan_unsat: %i[field_123],
+ rp_medwel: %i[field_124],
+ rp_hardship: %i[field_125],
+ rp_dontknow: %i[field_126],
+
+ cbl: %i[field_127],
+ cap: %i[field_128],
+ chr: %i[field_129],
+ accessible_register: %i[field_130],
+ letting_allocation: %i[field_127 field_128 field_129 field_130],
+
+ referral_register: %i[field_131 field_132],
+ referral_noms: %i[field_133],
+ referral_org: %i[field_134],
+
+ net_income_known: %i[field_135],
+ incfreq: %i[field_136],
+ earnings: %i[field_137],
+ hb: %i[field_138],
+ benefits: %i[field_139],
+
+ period: %i[field_141],
+ brent: %i[field_142],
+ scharge: %i[field_143],
+ pscharge: %i[field_144],
+ supcharg: %i[field_145],
+ tcharge: %i[field_142 field_143 field_144 field_145],
+ household_charge: %i[field_140],
+ hbrentshortfall: %i[field_146],
+ tshortfall: %i[field_147],
unitletas: %i[field_17],
rsnvac: %i[field_16],
- sheltered: %i[field_36],
-
- illness_type_1: %i[field_94],
- illness_type_2: %i[field_88],
- illness_type_3: %i[field_91],
- illness_type_4: %i[field_86],
- illness_type_5: %i[field_87],
- illness_type_6: %i[field_89],
- illness_type_7: %i[field_90],
- illness_type_8: %i[field_93],
- illness_type_9: %i[field_92],
- illness_type_10: %i[field_95],
+ sheltered: %i[field_35],
+
+ illness_type_1: %i[field_109],
+ illness_type_2: %i[field_103],
+ illness_type_3: %i[field_106],
+ illness_type_4: %i[field_101],
+ illness_type_5: %i[field_102],
+ illness_type_6: %i[field_104],
+ illness_type_7: %i[field_105],
+ illness_type_8: %i[field_108],
+ illness_type_9: %i[field_107],
+ illness_type_10: %i[field_110],
irproduct_other: %i[field_12],
propcode: %i[field_14],
- majorrepairs: %i[field_33 field_34 field_35],
- mrcdate: %i[field_33 field_34 field_35],
+ majorrepairs: %i[field_32 field_33 field_34],
+ mrcdate: %i[field_32 field_33 field_34],
- voiddate: %i[field_30 field_31 field_32],
+ voiddate: %i[field_29 field_30 field_31],
uprn: [:field_18],
address_line1: [:field_19],
@@ -1233,14 +1258,23 @@ private
county: [:field_22],
uprn_selection: [:field_19],
- sexrab1: %i[field_130],
- sexrab2: %i[field_131],
- sexrab3: %i[field_132],
- sexrab4: %i[field_133],
- sexrab5: %i[field_134],
- sexrab6: %i[field_135],
- sexrab7: %i[field_136],
- sexrab8: %i[field_137],
+ gender_same_as_sex1: %i[field_43],
+ gender_description1: %i[field_44],
+ gender_same_as_sex2: %i[field_51],
+ gender_description2: %i[field_52],
+ gender_same_as_sex3: %i[field_57],
+ gender_description3: %i[field_58],
+ gender_same_as_sex4: %i[field_63],
+ gender_description4: %i[field_64],
+ gender_same_as_sex5: %i[field_69],
+ gender_description5: %i[field_70],
+ gender_same_as_sex6: %i[field_75],
+ gender_description6: %i[field_76],
+ gender_same_as_sex7: %i[field_81],
+ gender_description7: %i[field_82],
+ gender_same_as_sex8: %i[field_87],
+ gender_description8: %i[field_88],
+
}.compact
end
@@ -1268,70 +1302,69 @@ private
attributes["rent_type"] = RENT_TYPE_BU_MAPPING[field_11]
attributes["startdate"] = startdate
attributes["unittype_gn"] = field_26
- attributes["builtype"] = field_27
- attributes["wchair"] = field_28
- attributes["beds"] = field_26 == 2 ? 1 : field_29
- attributes["joint"] = field_37
- attributes["startertenancy"] = field_38
- attributes["tenancy"] = field_39
- attributes["tenancyother"] = field_40
- attributes["tenancylength"] = field_41
+ attributes["wchair"] = field_27
+ attributes["beds"] = field_26 == 2 ? 1 : field_28
+ attributes["joint"] = field_36
+ attributes["startertenancy"] = field_37
+ attributes["tenancy"] = field_38
+ attributes["tenancyother"] = field_39
+ attributes["tenancylength"] = field_40
attributes["declaration"] = field_15
attributes["age1_known"] = age1_known?
- attributes["age1"] = field_42 if attributes["age1_known"]&.zero? && field_42&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age1"] = field_41 if attributes["age1_known"]&.zero? && field_41&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age2_known"] = age2_known?
attributes["age2"] = field_48 if attributes["age2_known"]&.zero? && field_48&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age3_known"] = age3_known?
- attributes["age3"] = field_52 if attributes["age3_known"]&.zero? && field_52&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age3"] = field_54 if attributes["age3_known"]&.zero? && field_54&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age4_known"] = age4_known?
- attributes["age4"] = field_56 if attributes["age4_known"]&.zero? && field_56&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age4"] = field_60 if attributes["age4_known"]&.zero? && field_60&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age5_known"] = age5_known?
- attributes["age5"] = field_60 if attributes["age5_known"]&.zero? && field_60&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age5"] = field_66 if attributes["age5_known"]&.zero? && field_66&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age6_known"] = age6_known?
- attributes["age6"] = field_64 if attributes["age6_known"]&.zero? && field_64&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age6"] = field_72 if attributes["age6_known"]&.zero? && field_72&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age7_known"] = age7_known?
- attributes["age7"] = field_68 if attributes["age7_known"]&.zero? && field_68&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age7"] = field_78 if attributes["age7_known"]&.zero? && field_78&.match(/\A\d{1,3}\z|\AR\z/)
attributes["age8_known"] = age8_known?
- attributes["age8"] = field_72 if attributes["age8_known"]&.zero? && field_72&.match(/\A\d{1,3}\z|\AR\z/)
+ attributes["age8"] = field_84 if attributes["age8_known"]&.zero? && field_84&.match(/\A\d{1,3}\z|\AR\z/)
- attributes["sex1"] = field_43
- attributes["sex2"] = field_49
- attributes["sex3"] = field_53
- attributes["sex4"] = field_57
- attributes["sex5"] = field_61
- attributes["sex6"] = field_65
- attributes["sex7"] = field_69
- attributes["sex8"] = field_73
+ attributes["sexrab1"] = field_42
+ attributes["sexrab2"] = field_50
+ attributes["sexrab3"] = field_56
+ attributes["sexrab4"] = field_62
+ attributes["sexrab5"] = field_68
+ attributes["sexrab6"] = field_74
+ attributes["sexrab7"] = field_80
+ attributes["sexrab8"] = field_86
attributes["ethnic_group"] = ethnic_group_from_ethnic
- attributes["ethnic"] = field_44
- attributes["nationality_all"] = field_45 if field_45.present? && valid_nationality_options.include?(field_45.to_s)
+ attributes["ethnic"] = field_45
+ attributes["nationality_all"] = field_46 if field_46.present? && valid_nationality_options.include?(field_46.to_s)
attributes["nationality_all_group"] = nationality_group(attributes["nationality_all"])
- attributes["relat2"] = relationship_from_input_value(field_47)
- attributes["relat3"] = relationship_from_input_value(field_51)
- attributes["relat4"] = relationship_from_input_value(field_55)
- attributes["relat5"] = relationship_from_input_value(field_59)
- attributes["relat6"] = relationship_from_input_value(field_63)
- attributes["relat7"] = relationship_from_input_value(field_67)
- attributes["relat8"] = relationship_from_input_value(field_71)
-
- attributes["ecstat1"] = field_46
- attributes["ecstat2"] = field_50
- attributes["ecstat3"] = field_54
- attributes["ecstat4"] = field_58
- attributes["ecstat5"] = field_62
- attributes["ecstat6"] = field_66
- attributes["ecstat7"] = field_70
- attributes["ecstat8"] = field_74
+ attributes["relat2"] = relationship_from_input_value(field_49)
+ attributes["relat3"] = relationship_from_input_value(field_55)
+ attributes["relat4"] = relationship_from_input_value(field_61)
+ attributes["relat5"] = relationship_from_input_value(field_67)
+ attributes["relat6"] = relationship_from_input_value(field_73)
+ attributes["relat7"] = relationship_from_input_value(field_79)
+ attributes["relat8"] = relationship_from_input_value(field_85)
+
+ attributes["ecstat1"] = field_47
+ attributes["ecstat2"] = field_53
+ attributes["ecstat3"] = field_59
+ attributes["ecstat4"] = field_65
+ attributes["ecstat5"] = field_71
+ attributes["ecstat6"] = field_77
+ attributes["ecstat7"] = field_83
+ attributes["ecstat8"] = field_89
attributes["details_known_2"] = details_known?(2)
attributes["details_known_3"] = details_known?(3)
@@ -1341,36 +1374,36 @@ private
attributes["details_known_7"] = details_known?(7)
attributes["details_known_8"] = details_known?(8)
- attributes["armedforces"] = field_75
+ attributes["armedforces"] = field_90
attributes["leftreg"] = leftreg
- attributes["reservist"] = field_77
+ attributes["reservist"] = field_92
- attributes["preg_occ"] = field_78
+ attributes["preg_occ"] = field_93
attributes["housingneeds"] = housingneeds
attributes["housingneeds_type"] = housingneeds_type
attributes["housingneeds_other"] = housingneeds_other
- attributes["illness"] = field_85
+ attributes["illness"] = field_100
- attributes["layear"] = field_96
- attributes["waityear"] = field_97
- attributes["reason"] = field_98
- attributes["reasonother"] = field_99 if reason_is_other?
- attributes["prevten"] = field_100
- attributes["homeless"] = field_101
+ attributes["layear"] = field_111
+ attributes["waityear"] = field_112
+ attributes["reason"] = field_113
+ attributes["reasonother"] = field_114 if reason_is_other?
+ attributes["prevten"] = field_115
+ attributes["homeless"] = field_116
attributes["prevloc"] = prevloc
attributes["previous_la_known"] = previous_la_known
attributes["ppcodenk"] = ppcodenk
attributes["ppostcode_full"] = ppostcode_full
- attributes["reasonpref"] = field_106
- attributes["rp_homeless"] = field_107 unless rp_dontknow_conflict?
- attributes["rp_insan_unsat"] = field_108 unless rp_dontknow_conflict?
- attributes["rp_medwel"] = field_109 unless rp_dontknow_conflict?
- attributes["rp_hardship"] = field_110 unless rp_dontknow_conflict?
- attributes["rp_dontknow"] = field_111 unless rp_dontknow_conflict?
+ attributes["reasonpref"] = field_121
+ attributes["rp_homeless"] = field_122 unless rp_dontknow_conflict?
+ attributes["rp_insan_unsat"] = field_123 unless rp_dontknow_conflict?
+ attributes["rp_medwel"] = field_124 unless rp_dontknow_conflict?
+ attributes["rp_hardship"] = field_125 unless rp_dontknow_conflict?
+ attributes["rp_dontknow"] = field_126 unless rp_dontknow_conflict?
attributes["cbl"] = cbl
attributes["chr"] = chr
@@ -1378,41 +1411,42 @@ private
attributes["accessible_register"] = accessible_register
attributes["letting_allocation_unknown"] = letting_allocation_unknown
- attributes["referral_type"] = referral_type
- attributes["referral"] = field_116
+ attributes["referral_register"] = referral_register
+ attributes["referral_noms"] = referral_noms
+ attributes["referral_org"] = referral_org
attributes["net_income_known"] = net_income_known
attributes["earnings"] = earnings
- attributes["incfreq"] = field_118
- attributes["hb"] = field_120
- attributes["benefits"] = field_121
-
- attributes["period"] = field_123
- attributes["brent"] = field_124 if all_charges_given?
- attributes["scharge"] = field_125 if all_charges_given?
- attributes["pscharge"] = field_126 if all_charges_given?
- attributes["supcharg"] = field_127 if all_charges_given?
- attributes["household_charge"] = supported_housing? ? field_122 : nil
- attributes["hbrentshortfall"] = field_128
+ attributes["incfreq"] = field_136
+ attributes["hb"] = field_138
+ attributes["benefits"] = field_139
+
+ attributes["period"] = field_141
+ attributes["brent"] = field_142 if all_charges_given?
+ attributes["scharge"] = field_143 if all_charges_given?
+ attributes["pscharge"] = field_144 if all_charges_given?
+ attributes["supcharg"] = field_145 if all_charges_given?
+ attributes["household_charge"] = supported_housing? ? field_140 : nil
+ attributes["hbrentshortfall"] = field_146
attributes["tshortfall_known"] = tshortfall_known
- attributes["tshortfall"] = field_129
+ attributes["tshortfall"] = field_147
attributes["hhmemb"] = hhmemb
attributes["unitletas"] = field_17
attributes["rsnvac"] = rsnvac
- attributes["sheltered"] = field_36
-
- attributes["illness_type_1"] = field_94
- attributes["illness_type_2"] = field_88
- attributes["illness_type_3"] = field_91
- attributes["illness_type_4"] = field_86
- attributes["illness_type_5"] = field_87
- attributes["illness_type_6"] = field_89
- attributes["illness_type_7"] = field_90
- attributes["illness_type_8"] = field_93
- attributes["illness_type_9"] = field_92
- attributes["illness_type_10"] = field_95
+ attributes["sheltered"] = field_35
+
+ attributes["illness_type_1"] = field_109
+ attributes["illness_type_2"] = field_103
+ attributes["illness_type_3"] = field_106
+ attributes["illness_type_4"] = field_101
+ attributes["illness_type_5"] = field_102
+ attributes["illness_type_6"] = field_104
+ attributes["illness_type_7"] = field_105
+ attributes["illness_type_8"] = field_108
+ attributes["illness_type_9"] = field_107
+ attributes["illness_type_10"] = field_110
attributes["irproduct_other"] = field_12 if RENT_TYPE_BU_MAPPING[field_11] == 5
@@ -1447,30 +1481,22 @@ private
attributes["postcode_full_input"] = postcode_full
attributes["select_best_address_match"] = true if field_18.blank?
- attributes["sexrab1"] = field_130
- attributes["sexrab2"] = field_131
- attributes["sexrab3"] = field_132
- attributes["sexrab4"] = field_133
- attributes["sexrab5"] = field_134
- attributes["sexrab6"] = field_135
- attributes["sexrab7"] = field_136
- attributes["sexrab8"] = field_137
- attributes["gender_same_as_sex1"] = field_138
- attributes["gender_description1"] = field_139
- attributes["gender_same_as_sex2"] = field_140
- attributes["gender_description2"] = field_141
- attributes["gender_same_as_sex3"] = field_142
- attributes["gender_description3"] = field_143
- attributes["gender_same_as_sex4"] = field_144
- attributes["gender_description4"] = field_145
- attributes["gender_same_as_sex5"] = field_146
- attributes["gender_description5"] = field_147
- attributes["gender_same_as_sex6"] = field_148
- attributes["gender_description6"] = field_149
- attributes["gender_same_as_sex7"] = field_150
- attributes["gender_description7"] = field_151
- attributes["gender_same_as_sex8"] = field_152
- attributes["gender_description8"] = field_153
+ attributes["gender_same_as_sex1"] = field_43
+ attributes["gender_description1"] = field_44
+ attributes["gender_same_as_sex2"] = field_51
+ attributes["gender_description2"] = field_52
+ attributes["gender_same_as_sex3"] = field_57
+ attributes["gender_description3"] = field_58
+ attributes["gender_same_as_sex4"] = field_63
+ attributes["gender_description4"] = field_64
+ attributes["gender_same_as_sex5"] = field_69
+ attributes["gender_description5"] = field_70
+ attributes["gender_same_as_sex6"] = field_75
+ attributes["gender_description6"] = field_76
+ attributes["gender_same_as_sex7"] = field_81
+ attributes["gender_description7"] = field_82
+ attributes["gender_same_as_sex8"] = field_87
+ attributes["gender_description8"] = field_88
attributes
end
@@ -1534,9 +1560,9 @@ private
end
def ethnic_group_from_ethnic
- return nil if field_44.blank?
+ return nil if field_45.blank?
- case field_44
+ case field_45
when 1, 2, 3, 18, 20
0
when 4, 5, 6, 7
@@ -1553,23 +1579,24 @@ private
end
def age1_known?
- return 1 if field_42 == "R"
+ return 1 if field_41 == "R"
0
end
[
{ person: 2, field: :field_48 },
- { person: 3, field: :field_52 },
- { person: 4, field: :field_56 },
- { person: 5, field: :field_60 },
- { person: 6, field: :field_64 },
- { person: 7, field: :field_68 },
- { person: 8, field: :field_72 },
+ { person: 3, field: :field_54 },
+ { person: 4, field: :field_60 },
+ { person: 5, field: :field_66 },
+ { person: 6, field: :field_72 },
+ { person: 7, field: :field_78 },
+ { person: 8, field: :field_84 },
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1578,53 +1605,53 @@ private
end
def person_2_present?
- field_47.present? || field_48.present? || field_49.present? || field_131.present? || field_140.present? || field_141.present?
+ field_49.present? || field_48.present? || field_50.present? || field_51.present? || field_52.present?
end
def person_3_present?
- field_51.present? || field_52.present? || field_53.present? || field_132.present? || field_142.present? || field_143.present?
+ field_55.present? || field_54.present? || field_56.present? || field_57.present? || field_58.present?
end
def person_4_present?
- field_55.present? || field_56.present? || field_57.present? || field_133.present? || field_144.present? || field_145.present?
+ field_61.present? || field_60.present? || field_62.present? || field_63.present? || field_64.present?
end
def person_5_present?
- field_59.present? || field_60.present? || field_61.present? || field_134.present? || field_146.present? || field_147.present?
+ field_67.present? || field_66.present? || field_68.present? || field_69.present? || field_70.present?
end
def person_6_present?
- field_63.present? || field_64.present? || field_65.present? || field_135.present? || field_148.present? || field_149.present?
+ field_73.present? || field_72.present? || field_74.present? || field_75.present? || field_76.present?
end
def person_7_present?
- field_67.present? || field_68.present? || field_69.present? || field_136.present? || field_150.present? || field_151.present?
+ field_79.present? || field_78.present? || field_80.present? || field_81.present? || field_82.present?
end
def person_8_present?
- field_71.present? || field_72.present? || field_73.present? || field_137.present? || field_152.present? || field_153.present?
+ field_85.present? || field_84.present? || field_86.present? || field_87.present? || field_88.present?
end
def leftreg
- field_76
+ field_91
end
def housingneeds
- if field_83 == 1
+ if field_98 == 1
2
- elsif field_84 == 1
+ elsif field_99 == 1
3
- elsif field_83.blank? || field_83&.zero?
+ elsif field_98.blank? || field_98&.zero?
1
end
end
def housingneeds_type
- if field_79 == 1
+ if field_94 == 1
0
- elsif field_80 == 1
+ elsif field_95 == 1
1
- elsif field_81 == 1
+ elsif field_96 == 1
2
else
3
@@ -1632,12 +1659,13 @@ private
end
def housingneeds_other
- return 1 if field_82 == 1
- return 0 if [field_79, field_80, field_81].include?(1)
+ return 1 if field_97 == 1
+
+ 0 if [field_94, field_95, field_96].include?(1)
end
def prevloc
- field_105
+ field_120
end
def previous_la_known
@@ -1645,7 +1673,7 @@ private
end
def ppcodenk
- case field_102
+ case field_117
when 1
0
when 2
@@ -1654,11 +1682,11 @@ private
end
def ppostcode_full
- "#{field_103} #{field_104}".strip.gsub(/\s+/, " ")
+ "#{field_118} #{field_119}".strip.gsub(/\s+/, " ")
end
def cbl
- case field_112
+ case field_127
when 2
0
when 1
@@ -1667,7 +1695,7 @@ private
end
def cap
- case field_113
+ case field_128
when 2
0
when 1
@@ -1676,7 +1704,7 @@ private
end
def chr
- case field_114
+ case field_129
when 2
0
when 1
@@ -1685,7 +1713,7 @@ private
end
def accessible_register
- case field_115
+ case field_130
when 2
0
when 1
@@ -1698,7 +1726,7 @@ private
end
def net_income_known
- case field_117
+ case field_135
when 1
0
when 2
@@ -1709,11 +1737,11 @@ private
end
def earnings
- field_119.round if field_119.present?
+ field_137.presence&.round
end
def tshortfall_known
- field_128 == 1 ? 0 : 1
+ field_146 == 1 ? 0 : 1
end
def hhmemb
@@ -1733,15 +1761,15 @@ private
end
def mrcdate
- year = field_35.to_s.strip.length.between?(1, 2) ? field_35 + 2000 : field_35
- Date.new(year, field_34, field_33) if field_35.present? && field_34.present? && field_33.present?
+ year = field_34.to_s.strip.length.between?(1, 2) ? field_34 + 2000 : field_34
+ Date.new(year, field_33, field_32) if field_34.present? && field_33.present? && field_32.present?
rescue Date::Error
Date.new
end
def voiddate
- year = field_32.to_s.strip.length.between?(1, 2) ? field_32 + 2000 : field_32
- Date.new(year, field_31, field_30) if field_32.present? && field_31.present? && field_30.present?
+ year = field_31.to_s.strip.length.between?(1, 2) ? field_31 + 2000 : field_31
+ Date.new(year, field_30, field_29) if field_31.present? && field_30.present? && field_29.present?
rescue Date::Error
Date.new
end
@@ -1768,7 +1796,7 @@ private
end
def reason_is_other?
- field_98 == 20
+ field_113 == 20
end
def bulk_upload_organisation
@@ -1787,31 +1815,46 @@ private
end
def rp_dontknow_conflict?
- other_reason_fields = %i[field_107 field_108 field_109 field_110]
- if field_106 == 1
+ other_reason_fields = %i[field_122 field_123 field_124 field_125]
+ if field_121 == 1
selected_reasons = other_reason_fields.select { |field| send(field) == 1 }
- dont_know_selected = field_111 == 1
+ dont_know_selected = field_126 == 1
return true if selected_reasons.any? && dont_know_selected
end
false
end
- def referral_type
- mapping = {
- 1 => [20, 2, 8],
- 2 => [21, 3, 4, 22],
- 3 => [1, 10, 23],
- 4 => [15, 9, 14, 24, 17],
- 5 => [18, 19],
- 6 => [7],
- 7 => [16],
- }
+ def referral_register
+ return unless owning_organisation
+ # by default CORE will ingest all these fields and nil questions that aren't asked.
+ # here, we specifically want the log to be invalid if any of the referral fields are wrong.
+ # BU will only consider a log invalid if its incomplete.
+ # so, nil these fields if any are invalid.
+ return unless referral_fields_valid?
+
+ if owning_organisation.la?
+ field_131
+ else
+ field_132
+ end
+ end
- mapping.each do |key, values|
- return key if values.include?(field_116)
+ def referral_noms
+ return unless owning_organisation
+ return unless referral_fields_valid?
+
+ if owning_organisation.prp?
+ field_133
end
+ end
- 0
+ def referral_org
+ return unless owning_organisation
+ return unless referral_fields_valid?
+
+ if owning_organisation.prp?
+ field_134
+ end
end
end
diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb
index ddcf18b6a..75f964e7c 100644
--- a/app/services/bulk_upload/sales/year2023/row_parser.rb
+++ b/app/services/bulk_upload/sales/year2023/row_parser.rb
@@ -915,7 +915,7 @@ private
attributes["mortlen"] = mortlen
attributes["proplen"] = proplen if proplen&.positive?
- attributes["proplen_asked"] = attributes["proplen"]&.present? ? 0 : 1
+ attributes["proplen_asked"] = attributes["proplen"].present? ? 0 : 1
attributes["jointmore"] = field_15
attributes["staircase"] = field_87
attributes["privacynotice"] = field_29
@@ -992,7 +992,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1050,72 +1051,84 @@ private
def sale_type
return field_8 if shared_ownership?
return field_9 if discounted_ownership?
- return field_10 if outright_sale?
+
+ field_10 if outright_sale?
end
def value
return field_103 if shared_ownership?
return field_116 if discounted_ownership?
- return field_127 if outright_sale?
+
+ field_127 if outright_sale?
end
def mortgage
return field_106 if shared_ownership?
return field_120 if discounted_ownership?
- return field_129 if outright_sale?
+
+ field_129 if outright_sale?
end
def extrabor
return field_110 if shared_ownership?
return field_124 if discounted_ownership?
- return field_133 if outright_sale?
+
+ field_133 if outright_sale?
end
def deposit
return field_111 if shared_ownership?
return field_125 if discounted_ownership?
- return field_134 if outright_sale?
+
+ field_134 if outright_sale?
end
def mscharge
return field_114 if shared_ownership?
return field_126 if discounted_ownership?
- return field_135 if outright_sale?
+
+ field_135 if outright_sale?
end
def mortgagelender
return field_107 if shared_ownership?
return field_121 if discounted_ownership?
- return field_130 if outright_sale?
+
+ field_130 if outright_sale?
end
def mortgagelenderother
return field_108 if shared_ownership?
return field_122 if discounted_ownership?
- return field_131 if outright_sale?
+
+ field_131 if outright_sale?
end
def mortlen
return field_109 if shared_ownership?
return field_123 if discounted_ownership?
- return field_132 if outright_sale?
+
+ field_132 if outright_sale?
end
def proplen
return field_86 if shared_ownership?
- return field_115 if discounted_ownership?
+
+ field_115 if discounted_ownership?
end
def mortgageused
return field_105 if shared_ownership?
return field_119 if discounted_ownership?
- return field_128 if outright_sale?
+
+ field_128 if outright_sale?
end
def mortgageused_field
return :field_105 if shared_ownership?
return :field_119 if discounted_ownership?
- return :field_128 if outright_sale?
+
+ :field_128 if outright_sale?
end
def owning_organisation
@@ -1263,7 +1276,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next if question_id == "type"
diff --git a/app/services/bulk_upload/sales/year2024/row_parser.rb b/app/services/bulk_upload/sales/year2024/row_parser.rb
index a1b214182..879bdbb3f 100644
--- a/app/services/bulk_upload/sales/year2024/row_parser.rb
+++ b/app/services/bulk_upload/sales/year2024/row_parser.rb
@@ -938,7 +938,7 @@ private
attributes["mortlen"] = mortlen
attributes["proplen"] = proplen if proplen&.positive?
- attributes["proplen_asked"] = attributes["proplen"]&.present? ? 0 : 1
+ attributes["proplen_asked"] = attributes["proplen"].present? ? 0 : 1
attributes["jointmore"] = field_16
attributes["staircase"] = field_86
attributes["privacynotice"] = field_18
@@ -1026,7 +1026,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1084,64 +1085,75 @@ private
def sale_type
return field_9 if shared_ownership?
return field_10 if discounted_ownership?
- return field_11 if outright_sale?
+
+ field_11 if outright_sale?
end
def value
return field_101 if shared_ownership?
return field_114 if discounted_ownership?
- return field_125 if outright_sale?
+
+ field_125 if outright_sale?
end
def mortgage
return field_104 if shared_ownership?
return field_118 if discounted_ownership?
- return field_127 if outright_sale?
+
+ field_127 if outright_sale?
end
def extrabor
return field_108 if shared_ownership?
return field_122 if discounted_ownership?
- return field_129 if outright_sale?
+
+ field_129 if outright_sale?
end
def deposit
return field_109 if shared_ownership?
return field_123 if discounted_ownership?
- return field_130 if outright_sale?
+
+ field_130 if outright_sale?
end
def mscharge
return field_112 if shared_ownership?
return field_124 if discounted_ownership?
- return field_131 if outright_sale?
+
+ field_131 if outright_sale?
end
def mortgagelender
return field_105 if shared_ownership?
- return field_119 if discounted_ownership?
+
+ field_119 if discounted_ownership?
end
def mortgagelenderother
return field_106 if shared_ownership?
- return field_120 if discounted_ownership?
+
+ field_120 if discounted_ownership?
end
def mortlen
return field_107 if shared_ownership?
return field_121 if discounted_ownership?
- return field_128 if outright_sale?
+
+ field_128 if outright_sale?
end
def proplen
return field_85 if shared_ownership?
- return field_113 if discounted_ownership?
+
+ field_113 if discounted_ownership?
end
def mortgageused
return field_103 if shared_ownership?
return field_117 if discounted_ownership?
- return field_126 if outright_sale?
+
+ field_126 if outright_sale?
end
def value_fields
@@ -1393,7 +1405,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next if question_id == "type"
diff --git a/app/services/bulk_upload/sales/year2025/row_parser.rb b/app/services/bulk_upload/sales/year2025/row_parser.rb
index dd5a65adf..19ad2cb1b 100644
--- a/app/services/bulk_upload/sales/year2025/row_parser.rb
+++ b/app/services/bulk_upload/sales/year2025/row_parser.rb
@@ -937,7 +937,7 @@ private
attributes["mortlen"] = mortlen
attributes["proplen"] = proplen if proplen&.positive?
- attributes["proplen_asked"] = attributes["proplen"]&.present? ? 0 : 1
+ attributes["proplen_asked"] = attributes["proplen"].present? ? 0 : 1
attributes["jointmore"] = field_13
attributes["staircase"] = field_10
attributes["privacynotice"] = field_15
@@ -1039,7 +1039,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1107,58 +1108,68 @@ private
def sale_type
return field_9 if shared_ownership?
- return field_11 if discounted_ownership?
+
+ field_11 if discounted_ownership?
end
def value
return field_86 if shared_ownership_initial_purchase?
return field_113 if discounted_ownership?
- return field_107 if staircasing?
+
+ field_107 if staircasing?
end
def equity
return field_87 if shared_ownership_initial_purchase?
- return field_108 if staircasing?
+
+ field_108 if staircasing?
end
def mortgage
return field_89 if shared_ownership?
- return field_117 if discounted_ownership?
+
+ field_117 if discounted_ownership?
end
def extrabor
- return field_119 if discounted_ownership?
+ field_119 if discounted_ownership?
end
def deposit
return field_91 if shared_ownership?
- return field_120 if discounted_ownership?
+
+ field_120 if discounted_ownership?
end
def mrent
return field_93 if shared_ownership_initial_purchase?
- return field_111 if staircasing?
+
+ field_111 if staircasing?
end
def mscharge
return field_94 if shared_ownership?
- return field_121 if discounted_ownership?
+
+ field_121 if discounted_ownership?
end
def mortlen
return field_90 if shared_ownership?
- return field_118 if discounted_ownership?
+
+ field_118 if discounted_ownership?
end
def proplen
return field_79 if shared_ownership?
- return field_112 if discounted_ownership?
+
+ field_112 if discounted_ownership?
end
def mortgageused
return field_88 if shared_ownership_initial_purchase?
return field_116 if discounted_ownership?
- return field_109 if staircasing?
+
+ field_109 if staircasing?
end
def value_fields
@@ -1400,7 +1411,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next if question_id == "type"
diff --git a/app/services/bulk_upload/sales/year2026/row_parser.rb b/app/services/bulk_upload/sales/year2026/row_parser.rb
index c541e0941..eeff4c716 100644
--- a/app/services/bulk_upload/sales/year2026/row_parser.rb
+++ b/app/services/bulk_upload/sales/year2026/row_parser.rb
@@ -965,7 +965,7 @@ private
attributes["mortlen"] = mortlen
attributes["proplen"] = proplen if proplen&.positive?
- attributes["proplen_asked"] = attributes["proplen"]&.present? ? 0 : 1
+ attributes["proplen_asked"] = attributes["proplen"].present? ? 0 : 1
attributes["jointmore"] = field_13
attributes["staircase"] = field_10
attributes["privacynotice"] = field_15
@@ -1067,7 +1067,8 @@ private
].each do |hash|
define_method("age#{hash[:person]}_known?") do
return 1 if public_send(hash[:field]) == "R"
- return 0 if send("person_#{hash[:person]}_present?")
+
+ 0 if send("person_#{hash[:person]}_present?")
end
end
@@ -1135,58 +1136,68 @@ private
def sale_type
return field_9 if shared_ownership?
- return field_11 if discounted_ownership?
+
+ field_11 if discounted_ownership?
end
def value
return field_86 if shared_ownership_initial_purchase?
return field_113 if discounted_ownership?
- return field_107 if staircasing?
+
+ field_107 if staircasing?
end
def equity
return field_87 if shared_ownership_initial_purchase?
- return field_108 if staircasing?
+
+ field_108 if staircasing?
end
def mortgage
return field_89 if shared_ownership?
- return field_117 if discounted_ownership?
+
+ field_117 if discounted_ownership?
end
def extrabor
- return field_119 if discounted_ownership?
+ field_119 if discounted_ownership?
end
def deposit
return field_91 if shared_ownership?
- return field_120 if discounted_ownership?
+
+ field_120 if discounted_ownership?
end
def mrent
return field_93 if shared_ownership_initial_purchase?
- return field_111 if staircasing?
+
+ field_111 if staircasing?
end
def mscharge
return field_94 if shared_ownership?
- return field_121 if discounted_ownership?
+
+ field_121 if discounted_ownership?
end
def mortlen
return field_90 if shared_ownership?
- return field_118 if discounted_ownership?
+
+ field_118 if discounted_ownership?
end
def proplen
return field_79 if shared_ownership?
- return field_112 if discounted_ownership?
+
+ field_112 if discounted_ownership?
end
def mortgageused
return field_88 if shared_ownership_initial_purchase?
return field_116 if discounted_ownership?
- return field_109 if staircasing?
+
+ field_109 if staircasing?
end
def value_fields
@@ -1429,7 +1440,7 @@ private
end
def validate_valid_radio_option
- log.attributes.each do |question_id, _v|
+ log.attributes.each_key do |question_id|
question = log.form.get_question(question_id, log)
next if question_id == "type"
diff --git a/app/services/csv/lettings_log_csv_service.rb b/app/services/csv/lettings_log_csv_service.rb
index 003515ac9..dd3be8595 100644
--- a/app/services/csv/lettings_log_csv_service.rb
+++ b/app/services/csv/lettings_log_csv_service.rb
@@ -398,12 +398,14 @@ module Csv
def label_if_boolean_value(value)
return "Yes" if value == true
- return "No" if value == false
+
+ "No" if value == false
end
def conventional_yes_no_label(value)
return "Yes" if value == 1
- return "No" if value&.zero?
+
+ "No" if value&.zero?
end
end
end
diff --git a/app/services/csv/sales_log_csv_service.rb b/app/services/csv/sales_log_csv_service.rb
index ed16653f1..07ccad82c 100644
--- a/app/services/csv/sales_log_csv_service.rb
+++ b/app/services/csv/sales_log_csv_service.rb
@@ -408,7 +408,8 @@ module Csv
def label_if_boolean_value(value)
return "Yes" if value == true
- return "No" if value == false
+
+ "No" if value == false
end
end
end
diff --git a/app/services/documentation_generator.rb b/app/services/documentation_generator.rb
index c2005f320..58c2031f7 100644
--- a/app/services/documentation_generator.rb
+++ b/app/services/documentation_generator.rb
@@ -93,7 +93,7 @@ class DocumentationGenerator
interruption_screen_pages = form.pages.select { |page| page.questions.first.type == "interruption_screen" }
interruption_screen_pages_grouped_by_question = interruption_screen_pages.group_by { |page| page.questions.first.id }
- interruption_screen_pages_grouped_by_question.each do |_question_id, pages|
+ interruption_screen_pages_grouped_by_question.each_value do |pages|
pages.map do |page|
save_soft_validation(form, page, validation_descriptions, log_type)
end
diff --git a/app/services/exports/lettings_log_export_constants.rb b/app/services/exports/lettings_log_export_constants.rb
index b954a5afd..f4d426a35 100644
--- a/app/services/exports/lettings_log_export_constants.rb
+++ b/app/services/exports/lettings_log_export_constants.rb
@@ -77,7 +77,6 @@ module Exports::LettingsLogExportConstants
"reason",
"reasonother",
"reasonpref",
- "referral",
"refused",
"reghome",
"renttype",
@@ -141,7 +140,6 @@ module Exports::LettingsLogExportConstants
(1..8).each do |index|
ALL_YEAR_EXPORT_FIELDS << "age#{index}"
ALL_YEAR_EXPORT_FIELDS << "ecstat#{index}"
- ALL_YEAR_EXPORT_FIELDS << "sex#{index}"
end
(2..8).each do |index|
ALL_YEAR_EXPORT_FIELDS << "relat#{index}"
@@ -158,21 +156,33 @@ module Exports::LettingsLogExportConstants
"chcharge",
"national",
"offered",
+ "referral",
]
+ (1..8).each do |index|
+ YEAR_2021_EXPORT_FIELDS << "sex#{index}"
+ end
YEAR_2022_EXPORT_FIELDS = Set[
"builtype",
"chcharge",
"national",
"offered",
+ "referral",
]
+ (1..8).each do |index|
+ YEAR_2022_EXPORT_FIELDS << "sex#{index}"
+ end
YEAR_2023_EXPORT_FIELDS = Set[
"builtype",
"chcharge",
"national",
"offered",
+ "referral",
]
+ (1..8).each do |index|
+ YEAR_2023_EXPORT_FIELDS << "sex#{index}"
+ end
YEAR_2024_EXPORT_FIELDS = Set[
"builtype",
@@ -192,7 +202,11 @@ module Exports::LettingsLogExportConstants
"pscharge_value_check",
"supcharg_value_check",
"carehome_charges_value_check",
+ "referral",
]
+ (1..8).each do |index|
+ YEAR_2024_EXPORT_FIELDS << "sex#{index}"
+ end
YEAR_2025_EXPORT_FIELDS = Set[
"builtype",
@@ -210,7 +224,11 @@ module Exports::LettingsLogExportConstants
"scharge_value_check",
"pscharge_value_check",
"supcharg_value_check",
+ "referral",
]
+ (1..8).each do |index|
+ YEAR_2025_EXPORT_FIELDS << "sex#{index}"
+ end
YEAR_2026_EXPORT_FIELDS = Set[
"accessible_register",
@@ -227,8 +245,10 @@ module Exports::LettingsLogExportConstants
"scharge_value_check",
"pscharge_value_check",
"supcharg_value_check",
+ "referral_register",
+ "referral_noms",
+ "referral_org",
]
-
(1..8).each do |index|
YEAR_2026_EXPORT_FIELDS << "sexrab#{index}"
YEAR_2026_EXPORT_FIELDS << "gender_same_as_sex#{index}"
diff --git a/app/services/exports/organisation_export_constants.rb b/app/services/exports/organisation_export_constants.rb
index 6c78a55db..7ffbfd223 100644
--- a/app/services/exports/organisation_export_constants.rb
+++ b/app/services/exports/organisation_export_constants.rb
@@ -23,6 +23,6 @@ module Exports::OrganisationExportConstants
"dpo_email",
"profit_status",
"group",
- "status"
+ "status",
]
end
diff --git a/app/services/feature_toggle.rb b/app/services/feature_toggle.rb
index 4b2c440fc..e70528d3f 100644
--- a/app/services/feature_toggle.rb
+++ b/app/services/feature_toggle.rb
@@ -28,7 +28,7 @@ class FeatureToggle
end
def self.create_test_logs_enabled?
- Rails.env.development? || Rails.env.review?
+ Rails.env.development? || Rails.env.review? || Rails.env.staging?
end
def self.sales_export_enabled?
diff --git a/app/services/filter_manager.rb b/app/services/filter_manager.rb
index 7757ad39e..69e895809 100644
--- a/app/services/filter_manager.rb
+++ b/app/services/filter_manager.rb
@@ -121,7 +121,7 @@ class FilterManager
new_filters = new_filters.except("user") if params["assigned_to"] == "all"
new_filters["user"] = current_user.id.to_s if params["assigned_to"] == "you"
- new_filters = new_filters.except("user_text_search") if params["assigned_to"] == "all" || params["assigned_to"] == "you"
+ new_filters = new_filters.except("user_text_search") if %w[all you].include?(params["assigned_to"])
new_filters = new_filters.except("owning_organisation_text_search") if params["owning_organisation_select"] == "all"
new_filters = new_filters.except("managing_organisation_text_search") if params["managing_organisation_select"] == "all"
end
diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb
index b4feb12bd..d3c52c270 100644
--- a/app/views/form/_checkbox_question.html.erb
+++ b/app/views/form/_checkbox_question.html.erb
@@ -16,7 +16,7 @@
hint: { text: option["hint"] },
checked: @log[key] == 1,
exclusive: after_divider,
- link_errors: index.zero? ? true : nil,
+ link_errors: index.zero? || nil,
**stimulus_html_attributes(question) %>
<% end %>
<% end %>
diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb
index a1df5f4d5..28437f3b9 100644
--- a/app/views/form/_date_question.html.erb
+++ b/app/views/form/_date_question.html.erb
@@ -6,7 +6,7 @@
question_id: question.id,
legend: { text: legend[:text], size: legend[:size], caption: caption(caption_text, page_header, conditional) },
resource_type: @log.log_type,
- hint: (question.hint_text.blank? ? "" : (question.hint_text.html_safe + "".html_safe)) + "For example, #{date_mid_collection_year_formatted(@log.startdate).tr(' ', '/')}",
+ hint: date_hint(question, @log),
f:,
} %>
diff --git a/app/views/form/_interruption_screen_question.html.erb b/app/views/form/_interruption_screen_question.html.erb
index c0063e477..9aa38ca5d 100644
--- a/app/views/form/_interruption_screen_question.html.erb
+++ b/app/views/form/_interruption_screen_question.html.erb
@@ -18,7 +18,7 @@
<%= f.govuk_submit "Confirm and continue" %>
<%= govuk_link_to(
- (@page.skip_text || "Skip for now"),
- (@page.skip_href(@log) || send(@log.form.next_page_redirect_path(@page, @log, current_user, ignore_answered: true), @log)),
+ @page.skip_text || "Skip for now",
+ @page.skip_href(@log) || send(@log.form.next_page_redirect_path(@page, @log, current_user, ignore_answered: true), @log),
) %>
diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb
index bf6abb0d0..e810d7b7a 100644
--- a/app/views/form/_radio_question.html.erb
+++ b/app/views/form/_radio_question.html.erb
@@ -28,14 +28,14 @@
key,
label: { text: options["value"] },
hint: { text: options["hint"] },
- link_errors: index.zero? ? true : nil,
+ link_errors: index.zero? || nil,
**stimulus_html_attributes(question) %>
<% else %>
<%= f.govuk_radio_button question.id.to_sym,
key,
label: { text: options["value"] },
hint: { text: options["hint"] },
- link_errors: index.zero? ? true : nil,
+ link_errors: index.zero? || nil,
**stimulus_html_attributes(question) do %>
<%= render partial: "#{conditional_question.type}_question", locals: {
question: conditional_question,
diff --git a/app/views/rails_admin/main/_submit_buttons.html.erb b/app/views/rails_admin/main/_submit_buttons.html.erb
index 241624c4e..1768ce2b3 100644
--- a/app/views/rails_admin/main/_submit_buttons.html.erb
+++ b/app/views/rails_admin/main/_submit_buttons.html.erb
@@ -1,6 +1,6 @@