Browse Source

Merge branch 'main' into CLDC-1825-prepare-bulk-upload-guidance

pull/1342/head
natdeanlewissoftwire 3 years ago
parent
commit
0fbd8ce921
  1. 1
      .env.example
  2. 2
      .env.test
  3. 7
      .github/workflows/production_pipeline.yml
  4. 4
      .github/workflows/review_pipeline.yml
  5. 7
      .github/workflows/staging_pipeline.yml
  6. 114
      Gemfile.lock
  7. 9
      app/components/bulk_upload_error_row_component.rb
  8. 20
      app/components/bulk_upload_error_summary_table_component.html.erb
  9. 6
      app/components/bulk_upload_error_summary_table_component.rb
  10. 2
      app/components/check_answers_summary_list_card_component.html.erb
  11. 4
      app/components/check_answers_summary_list_card_component.rb
  12. 2
      app/controllers/bulk_upload_lettings_logs_controller.rb
  13. 2
      app/controllers/form_controller.rb
  14. 16
      app/controllers/lettings_logs_controller.rb
  15. 2
      app/controllers/locations_controller.rb
  16. 6
      app/controllers/organisations_controller.rb
  17. 24
      app/controllers/start_controller.rb
  18. 4
      app/helpers/check_answers_helper.rb
  19. 19
      app/helpers/locations_helper.rb
  20. 7
      app/helpers/logs_helper.rb
  21. 8
      app/helpers/question_view_helper.rb
  22. 4
      app/jobs/email_csv_job.rb
  23. 15
      app/mailers/bulk_upload_mailer.rb
  24. 22
      app/models/bulk_upload.rb
  25. 9
      app/models/derived_variables/sales_log_variables.rb
  26. 2
      app/models/form.rb
  27. 2
      app/models/form/lettings/pages/lead_tenant_nationality.rb
  28. 4
      app/models/form/lettings/pages/max_rent_value_check.rb
  29. 4
      app/models/form/lettings/pages/min_rent_value_check.rb
  30. 14
      app/models/form/lettings/pages/person_age.rb
  31. 4
      app/models/form/lettings/pages/previous_housing_situation.rb
  32. 4
      app/models/form/lettings/pages/previous_housing_situation_renewal.rb
  33. 2
      app/models/form/lettings/pages/property_let_type.rb
  34. 6
      app/models/form/lettings/pages/sheltered_accommodation.rb
  35. 6
      app/models/form/lettings/pages/starter_tenancy_type.rb
  36. 4
      app/models/form/lettings/pages/tenancy_length.rb
  37. 6
      app/models/form/lettings/pages/tenancy_type.rb
  38. 6
      app/models/form/lettings/questions/age.rb
  39. 1
      app/models/form/lettings/questions/age1.rb
  40. 1
      app/models/form/lettings/questions/age1_known.rb
  41. 1
      app/models/form/lettings/questions/age_known.rb
  42. 1
      app/models/form/lettings/questions/armedforces.rb
  43. 1
      app/models/form/lettings/questions/beds.rb
  44. 1
      app/models/form/lettings/questions/benefits.rb
  45. 2
      app/models/form/lettings/questions/brent_4_weekly.rb
  46. 2
      app/models/form/lettings/questions/brent_bi_weekly.rb
  47. 2
      app/models/form/lettings/questions/brent_monthly.rb
  48. 2
      app/models/form/lettings/questions/brent_weekly.rb
  49. 1
      app/models/form/lettings/questions/builtype.rb
  50. 1
      app/models/form/lettings/questions/chcharge_4_weekly.rb
  51. 1
      app/models/form/lettings/questions/chcharge_bi_weekly.rb
  52. 1
      app/models/form/lettings/questions/chcharge_monthly.rb
  53. 1
      app/models/form/lettings/questions/chcharge_weekly.rb
  54. 1
      app/models/form/lettings/questions/condition_effects.rb
  55. 3
      app/models/form/lettings/questions/declaration.rb
  56. 1
      app/models/form/lettings/questions/earnings.rb
  57. 1
      app/models/form/lettings/questions/ethnic_arab.rb
  58. 1
      app/models/form/lettings/questions/ethnic_asian.rb
  59. 1
      app/models/form/lettings/questions/ethnic_black.rb
  60. 1
      app/models/form/lettings/questions/ethnic_group.rb
  61. 1
      app/models/form/lettings/questions/ethnic_mixed.rb
  62. 1
      app/models/form/lettings/questions/ethnic_white.rb
  63. 1
      app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb
  64. 1
      app/models/form/lettings/questions/gender_identity1.rb
  65. 1
      app/models/form/lettings/questions/hb.rb
  66. 1
      app/models/form/lettings/questions/hbrentshortfall.rb
  67. 1
      app/models/form/lettings/questions/hhmemb.rb
  68. 1
      app/models/form/lettings/questions/homeless.rb
  69. 1
      app/models/form/lettings/questions/household_charge.rb
  70. 1
      app/models/form/lettings/questions/housingneeds.rb
  71. 1
      app/models/form/lettings/questions/housingneeds_other.rb
  72. 1
      app/models/form/lettings/questions/housingneeds_type.rb
  73. 1
      app/models/form/lettings/questions/illness.rb
  74. 1
      app/models/form/lettings/questions/incfreq.rb
  75. 1
      app/models/form/lettings/questions/irproduct_other.rb
  76. 1
      app/models/form/lettings/questions/is_carehome.rb
  77. 1
      app/models/form/lettings/questions/joint.rb
  78. 326
      app/models/form/lettings/questions/la.rb
  79. 1
      app/models/form/lettings/questions/layear.rb
  80. 1
      app/models/form/lettings/questions/leftreg.rb
  81. 1
      app/models/form/lettings/questions/letting_allocation.rb
  82. 1
      app/models/form/lettings/questions/location_id.rb
  83. 1
      app/models/form/lettings/questions/majorrepairs.rb
  84. 1
      app/models/form/lettings/questions/managing_organisation.rb
  85. 1
      app/models/form/lettings/questions/mrcdate.rb
  86. 7
      app/models/form/lettings/questions/nationality.rb
  87. 1
      app/models/form/lettings/questions/needs_type.rb
  88. 1
      app/models/form/lettings/questions/net_income_known.rb
  89. 7
      app/models/form/lettings/questions/offered.rb
  90. 7
      app/models/form/lettings/questions/offered_social_let.rb
  91. 1
      app/models/form/lettings/questions/period.rb
  92. 1
      app/models/form/lettings/questions/person_gender_identity.rb
  93. 3
      app/models/form/lettings/questions/person_relationship.rb
  94. 1
      app/models/form/lettings/questions/person_working_situation.rb
  95. 1
      app/models/form/lettings/questions/ppcodenk.rb
  96. 1
      app/models/form/lettings/questions/ppostcode_full.rb
  97. 1
      app/models/form/lettings/questions/preg_occ.rb
  98. 1
      app/models/form/lettings/questions/previous_la_known.rb
  99. 8
      app/models/form/lettings/questions/previous_let_type.rb
  100. 42
      app/models/form/lettings/questions/previous_tenure.rb
  101. Some files were not shown because too many files have changed in this diff Show More

1
.env.example

@ -5,3 +5,4 @@ GOVUK_NOTIFY_API_KEY=<notify-key-here-if-testing-emails-or-admin-users>
OTP_SECRET_ENCRYPTION_KEY="<Generate this using bundle exec rake secret>" OTP_SECRET_ENCRYPTION_KEY="<Generate this using bundle exec rake secret>"
APP_HOST="http://localhost:3000" APP_HOST="http://localhost:3000"
OS_DATA_KEY=OS_DATA_KEY

2
.env.test

@ -0,0 +1,2 @@
APP_HOST="http://localhost:3000"
OS_DATA_KEY=OS_DATA_KEY

7
.github/workflows/production_pipeline.yml

@ -42,6 +42,7 @@ jobs:
DB_USERNAME: postgres DB_USERNAME: postgres
DB_PASSWORD: password DB_PASSWORD: password
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
PARALLEL_TEST_PROCESSORS: 4
steps: steps:
- name: Get latest release with tag - name: Get latest release with tag
@ -71,7 +72,7 @@ jobs:
- name: Create database - name: Create database
run: | run: |
bundle exec rake db:prepare bundle exec rake parallel:setup
- name: Compile Assets - name: Compile Assets
run: | run: |
@ -79,7 +80,7 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
bundle exec rspec --exclude-pattern "features/*" --fail-fast bundle exec rake parallel:spec['spec\/(?!features)']
feature_test: feature_test:
name: Feature Tests name: Feature Tests
@ -236,6 +237,7 @@ jobs:
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}
APP_HOST: ${{ secrets.APP_HOST }} APP_HOST: ${{ secrets.APP_HOST }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
OS_DATA_KEY: ${{ secrets.OS_DATA_KEY }}
IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }}
EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }}
S3_CONFIG: ${{ secrets.S3_CONFIG }} S3_CONFIG: ${{ secrets.S3_CONFIG }}
@ -248,6 +250,7 @@ jobs:
cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY
cf set-env $APP_NAME APP_HOST $APP_HOST cf set-env $APP_NAME APP_HOST $APP_HOST
cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY
cf set-env $APP_NAME OS_DATA_KEY $OS_DATA_KEY
cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE
cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE
cf set-env $APP_NAME S3_CONFIG $S3_CONFIG cf set-env $APP_NAME S3_CONFIG $S3_CONFIG

4
.github/workflows/review_pipeline.yml

@ -110,6 +110,7 @@ jobs:
API_KEY: ${{ secrets.API_KEY }} API_KEY: ${{ secrets.API_KEY }}
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
OS_DATA_KEY: ${{ secrets.OS_DATA_KEY }}
IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }}
EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }}
S3_CONFIG: ${{ secrets.S3_CONFIG }} S3_CONFIG: ${{ secrets.S3_CONFIG }}
@ -120,10 +121,11 @@ jobs:
cf set-env $APP_NAME API_KEY $API_KEY cf set-env $APP_NAME API_KEY $API_KEY
cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY
cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY
cf set-env $APP_NAME OS_DATA_KEY $OS_DATA_KEY
cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE
cf set-env $APP_NAME EXPORT_PAAS_INSTANCE "dluhc-core-review-export-bucket" cf set-env $APP_NAME EXPORT_PAAS_INSTANCE "dluhc-core-review-export-bucket"
cf set-env $APP_NAME S3_CONFIG $S3_CONFIG cf set-env $APP_NAME S3_CONFIG $S3_CONFIG
cf set-env $APP_NAME CSV_DOWNLOAD_PAAS_INSTANCE "dluhc-core-review-csv-bucket" cf set-env $APP_NAME CSV_DOWNLOAD_PAAS_INSTANCE "dluhc-core-staging-csv-bucket"
cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN
cf set-env $APP_NAME APP_HOST "https://dluhc-core-review-${{ github.event.pull_request.number }}.london.cloudapps.digital" cf set-env $APP_NAME APP_HOST "https://dluhc-core-review-${{ github.event.pull_request.number }}.london.cloudapps.digital"

7
.github/workflows/staging_pipeline.yml

@ -45,6 +45,7 @@ jobs:
DB_USERNAME: postgres DB_USERNAME: postgres
DB_PASSWORD: password DB_PASSWORD: password
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
PARALLEL_TEST_PROCESSORS: 4
steps: steps:
- name: Checkout - name: Checkout
@ -63,7 +64,7 @@ jobs:
- name: Create database - name: Create database
run: | run: |
bundle exec rake db:prepare bundle exec rake parallel:setup
- name: Compile assets - name: Compile assets
run: | run: |
@ -71,7 +72,7 @@ jobs:
- name: Run tests - name: Run tests
run: | run: |
bundle exec rspec --exclude-pattern "features/*" --fail-fast bundle exec rake parallel:spec['spec\/(?!features)']
feature_test: feature_test:
name: Feature Tests name: Feature Tests
@ -207,6 +208,7 @@ jobs:
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }}
APP_HOST: ${{ secrets.APP_HOST }} APP_HOST: ${{ secrets.APP_HOST }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
OS_DATA_KEY: ${{ secrets.OS_DATA_KEY }}
IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }}
EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }}
S3_CONFIG: ${{ secrets.S3_CONFIG }} S3_CONFIG: ${{ secrets.S3_CONFIG }}
@ -221,6 +223,7 @@ jobs:
cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY
cf set-env $APP_NAME APP_HOST $APP_HOST cf set-env $APP_NAME APP_HOST $APP_HOST
cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY
cf set-env $APP_NAME OS_DATA_KEY $OS_DATA_KEY
cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE
cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE
cf set-env $APP_NAME S3_CONFIG $S3_CONFIG cf set-env $APP_NAME S3_CONFIG $S3_CONFIG

114
Gemfile.lock

@ -13,67 +13,67 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (7.0.4.2) actioncable (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (7.0.4.2) actionmailbox (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
activejob (= 7.0.4.2) activejob (= 7.0.4.3)
activerecord (= 7.0.4.2) activerecord (= 7.0.4.3)
activestorage (= 7.0.4.2) activestorage (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
mail (>= 2.7.1) mail (>= 2.7.1)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
actionmailer (7.0.4.2) actionmailer (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
actionview (= 7.0.4.2) actionview (= 7.0.4.3)
activejob (= 7.0.4.2) activejob (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap net-imap
net-pop net-pop
net-smtp net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (7.0.4.2) actionpack (7.0.4.3)
actionview (= 7.0.4.2) actionview (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.4.2) actiontext (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
activerecord (= 7.0.4.2) activerecord (= 7.0.4.3)
activestorage (= 7.0.4.2) activestorage (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (7.0.4.2) actionview (7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.4.2) activejob (7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (7.0.4.2) activemodel (7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
activerecord (7.0.4.2) activerecord (7.0.4.3)
activemodel (= 7.0.4.2) activemodel (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
activestorage (7.0.4.2) activestorage (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
activejob (= 7.0.4.2) activejob (= 7.0.4.3)
activerecord (= 7.0.4.2) activerecord (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
marcel (~> 1.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (7.0.4.2) activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
@ -134,7 +134,7 @@ GEM
launchy launchy
childprocess (4.1.0) childprocess (4.1.0)
coderay (1.1.3) coderay (1.1.3)
concurrent-ruby (1.2.0) concurrent-ruby (1.2.2)
connection_pool (2.3.0) connection_pool (2.3.0)
crack (0.4.5) crack (0.4.5)
rexml rexml
@ -221,7 +221,7 @@ GEM
matrix (0.4.2) matrix (0.4.2)
method_source (1.0.0) method_source (1.0.0)
mini_mime (1.1.2) mini_mime (1.1.2)
minitest (5.17.0) minitest (5.18.0)
msgpack (1.6.0) msgpack (1.6.0)
net-imap (0.3.4) net-imap (0.3.4)
date date
@ -279,35 +279,35 @@ GEM
nio4r (~> 2.0) nio4r (~> 2.0)
raabro (1.4.0) raabro (1.4.0)
racc (1.6.2) racc (1.6.2)
rack (2.2.6.3) rack (2.2.6.4)
rack-attack (6.6.1) rack-attack (6.6.1)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-mini-profiler (2.3.4) rack-mini-profiler (2.3.4)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-test (2.0.2) rack-test (2.1.0)
rack (>= 1.3) rack (>= 1.3)
rails (7.0.4.2) rails (7.0.4.3)
actioncable (= 7.0.4.2) actioncable (= 7.0.4.3)
actionmailbox (= 7.0.4.2) actionmailbox (= 7.0.4.3)
actionmailer (= 7.0.4.2) actionmailer (= 7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
actiontext (= 7.0.4.2) actiontext (= 7.0.4.3)
actionview (= 7.0.4.2) actionview (= 7.0.4.3)
activejob (= 7.0.4.2) activejob (= 7.0.4.3)
activemodel (= 7.0.4.2) activemodel (= 7.0.4.3)
activerecord (= 7.0.4.2) activerecord (= 7.0.4.3)
activestorage (= 7.0.4.2) activestorage (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 7.0.4.2) railties (= 7.0.4.3)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0) rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1) loofah (~> 2.19, >= 2.19.1)
railties (7.0.4.2) railties (7.0.4.3)
actionpack (= 7.0.4.2) actionpack (= 7.0.4.3)
activesupport (= 7.0.4.2) activesupport (= 7.0.4.3)
method_source method_source
rake (>= 12.2) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)

9
app/components/bulk_upload_error_row_component.rb

@ -24,14 +24,7 @@ class BulkUploadErrorRowComponent < ViewComponent::Base
end end
def question_for_field(field) def question_for_field(field)
case bulk_upload.log_type bulk_upload.prefix_namespace::RowParser.question_for_field(field.to_sym)
when "lettings"
BulkUpload::Lettings::Validator.question_for_field(field.to_sym)
when "sales"
BulkUpload::Sales::Validator.question_for_field(field.to_sym)
else
"Unknown question"
end
end end
def bulk_upload def bulk_upload

20
app/components/bulk_upload_error_summary_table_component.html.erb

@ -1,24 +1,16 @@
<%= govuk_table do |table| %> <% sorted_errors.each do |error| %>
<% table.caption(size: "m", text: bulk_upload.filename) %> <%= govuk_table do |table| %>
<% table.head do |head| %> <% table.head do |head| %>
<% head.row do |row| %> <% head.row do |row| %>
<% row.cell(text: "Column", header: true) %> <% row.cell(text: question_for_field(error[0][1].to_sym), header: true) %>
<% row.cell(text: "Number of rows", header: true) %> <% row.cell(text: "Column #{error[0][0]}", header: true, numeric: true) %>
<% row.cell(text: "Question", header: true) %>
<% row.cell(text: "Error", header: true) %>
<% row.cell(text: "Specification", header: true) %>
<% end %>
<% end %> <% end %>
<% table.body do |body| %> <% table.body do |body| %>
<% sorted_errors.each do |error| %>
<% body.row do |row| %> <% body.row do |row| %>
<% row.cell(text: error[0][0]) %>
<% row.cell(text: error[1]) %>
<% row.cell(text: BulkUpload::Lettings::Validator.question_for_field(error[0][1].to_sym)) %>
<% row.cell(text: error[0][2]) %> <% row.cell(text: error[0][2]) %>
<% row.cell(text: error[0][1]) %> <% row.cell(text: pluralize(error[1], "error"), numeric: true) %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

6
app/components/bulk_upload_error_summary_table_component.rb

@ -3,6 +3,8 @@ class BulkUploadErrorSummaryTableComponent < ViewComponent::Base
attr_reader :bulk_upload attr_reader :bulk_upload
delegate :question_for_field, to: :row_parser_class
def initialize(bulk_upload:) def initialize(bulk_upload:)
@bulk_upload = bulk_upload @bulk_upload = bulk_upload
@ -27,4 +29,8 @@ private
def display_threshold def display_threshold
DISPLAY_THRESHOLD DISPLAY_THRESHOLD
end end
def row_parser_class
bulk_upload.prefix_namespace::RowParser
end
end end

2
app/components/check_answers_summary_list_card_component.html.erb

@ -10,7 +10,7 @@
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% applicable_questions.each do |question| %> <% applicable_questions.each do |question| %>
<% summary_list.row do |row| %> <% summary_list.row do |row| %>
<% row.key { question.check_answer_label.to_s.presence || question.header.to_s } %> <% row.key { get_question_label(question) } %>
<% row.value do %> <% row.value do %>
<span class="govuk-!-margin-right-4"><%= get_answer_label(question) %></span> <span class="govuk-!-margin-right-4"><%= get_answer_label(question) %></span>

4
app/components/check_answers_summary_list_card_component.rb

@ -17,6 +17,10 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base
question.answer_label(log, user).presence || unanswered_value question.answer_label(log, user).presence || unanswered_value
end end
def get_question_label(question)
[question.question_number_string, question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ")
end
def check_answers_card_title(question) def check_answers_card_title(question)
return "Lead tenant" if question.form.type == "lettings" && question.check_answers_card_number == 1 return "Lead tenant" if question.form.type == "lettings" && question.check_answers_card_number == 1
return "Buyer #{question.check_answers_card_number}" if question.check_answers_card_number <= number_of_buyers return "Buyer #{question.check_answers_card_number}" if question.check_answers_card_number <= number_of_buyers

2
app/controllers/bulk_upload_lettings_logs_controller.rb

@ -33,6 +33,8 @@ private
end end
def in_crossover_period? def in_crossover_period?
return true if FeatureToggle.force_crossover?
FormHandler.instance.lettings_in_crossover_period? FormHandler.instance.lettings_in_crossover_period?
end end

2
app/controllers/form_controller.rb

@ -160,7 +160,7 @@ private
end end
def question_is_required?(question) def question_is_required?(question)
@log.class::OPTIONAL_FIELDS.exclude?(question.id) && required_questions.include?(question.id) @log.optional_fields.exclude?(question.id) && required_questions.include?(question.id)
end end
def required_questions def required_questions

16
app/controllers/lettings_logs_controller.rb

@ -2,10 +2,16 @@ class LettingsLogsController < LogsController
before_action :find_resource, except: %i[create index edit] before_action :find_resource, except: %i[create index edit]
before_action :session_filters, if: :current_user, only: %i[index email_csv download_csv] before_action :session_filters, if: :current_user, only: %i[index email_csv download_csv]
before_action :set_session_filters, if: :current_user, only: %i[index email_csv download_csv] before_action :set_session_filters, if: :current_user, only: %i[index email_csv download_csv]
before_action :authenticate_scope!, only: %i[download_csv email_csv]
before_action :extract_bulk_upload_from_session_filters, only: [:index] before_action :extract_bulk_upload_from_session_filters, only: [:index]
before_action :redirect_if_bulk_upload_resolved, only: [:index] before_action :redirect_if_bulk_upload_resolved, only: [:index]
def authenticate_scope!
codes_only_export = codes_only_export?(params)
head :unauthorized and return unless current_user.support? || !codes_only_export
end
def index def index
respond_to do |format| respond_to do |format|
format.html do format.html do
@ -80,13 +86,19 @@ class LettingsLogsController < LogsController
def download_csv def download_csv
unpaginated_filtered_logs = filtered_logs(current_user.lettings_logs, search_term, @session_filters) unpaginated_filtered_logs = filtered_logs(current_user.lettings_logs, search_term, @session_filters)
codes_only = codes_only_export?(params)
render "download_csv", locals: { search_term:, count: unpaginated_filtered_logs.size, post_path: email_csv_lettings_logs_path, codes_only: }
end
render "download_csv", locals: { search_term:, count: unpaginated_filtered_logs.size, post_path: email_csv_lettings_logs_path } def codes_only_export?(params)
params.require(:codes_only) == "true"
end end
def email_csv def email_csv
all_orgs = params["organisation_select"] == "all" all_orgs = params["organisation_select"] == "all"
EmailCsvJob.perform_later(current_user, search_term, @session_filters, all_orgs) codes_only_export = params.require(:codes_only) == "true"
EmailCsvJob.perform_later(current_user, search_term, @session_filters, all_orgs, nil, codes_only_export)
redirect_to csv_confirmation_lettings_logs_path redirect_to csv_confirmation_lettings_logs_path
end end

2
app/controllers/locations_controller.rb

@ -41,7 +41,7 @@ class LocationsController < ApplicationController
def update_local_authority def update_local_authority
@location.location_admin_district = location_params[:location_admin_district] @location.location_admin_district = location_params[:location_admin_district]
@location.location_code = Location.local_authorities.key(location_params[:location_admin_district]) @location.location_code = Location.local_authorities_for_current_year.key(location_params[:location_admin_district])
if @location.save(context: :location_admin_district) if @location.save(context: :location_admin_district)
if return_to_check_your_answers? || params[:referrer] == "check_local_authority" if return_to_check_your_answers? || params[:referrer] == "check_local_authority"
redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route]) redirect_to scheme_location_check_answers_path(@scheme, @location, route: params[:route])

6
app/controllers/organisations_controller.rb

@ -107,12 +107,14 @@ class OrganisationsController < ApplicationController
def download_csv def download_csv
organisation_logs = LettingsLog.all.where(owning_organisation_id: @organisation.id) organisation_logs = LettingsLog.all.where(owning_organisation_id: @organisation.id)
unpaginated_filtered_logs = filtered_logs(organisation_logs, search_term, @session_filters) unpaginated_filtered_logs = filtered_logs(organisation_logs, search_term, @session_filters)
codes_only = params.require(:codes_only) == "true"
render "logs/download_csv", locals: { search_term:, count: unpaginated_filtered_logs.size, post_path: logs_email_csv_organisation_path } render "logs/download_csv", locals: { search_term:, count: unpaginated_filtered_logs.size, post_path: logs_email_csv_organisation_path, codes_only: }
end end
def email_csv def email_csv
EmailCsvJob.perform_later(current_user, search_term, @session_filters, false, @organisation) codes_only_export = params.require(:codes_only) == "true"
EmailCsvJob.perform_later(current_user, search_term, @session_filters, false, @organisation, codes_only_export)
redirect_to logs_csv_confirmation_organisation_path redirect_to logs_csv_confirmation_organisation_path
end end

24
app/controllers/start_controller.rb

@ -4,4 +4,28 @@ class StartController < ApplicationController
redirect_to(lettings_logs_path) redirect_to(lettings_logs_path)
end end
end end
def download_23_24_sales_form
send_file(
Rails.root.join("public/files/2023_24_sales_paper_form.pdf"),
filename: "2023-24 Sales paper form.pdf",
type: "application/pdf",
)
end
def download_22_23_sales_form
send_file(
Rails.root.join("public/files/2022_23_sales_paper_form.pdf"),
filename: "2022-23 Sales paper form.pdf",
type: "application/pdf",
)
end
def download_23_24_lettings_form
send_file(
Rails.root.join("public/files/2023_24_lettings_paper_form.pdf"),
filename: "2023-24 Lettings paper form.pdf",
type: "application/pdf",
)
end
end end

4
app/helpers/check_answers_helper.rb

@ -45,4 +45,8 @@ private
def get_answer_label(question, lettings_log) def get_answer_label(question, lettings_log)
question.answer_label(lettings_log, current_user).presence || "<span class=\"app-!-colour-muted\">You didn’t answer this question</span>".html_safe question.answer_label(lettings_log, current_user).presence || "<span class=\"app-!-colour-muted\">You didn’t answer this question</span>".html_safe
end end
def get_question_label(question)
[question.question_number_string, question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ")
end
end end

19
app/helpers/locations_helper.rb

@ -14,7 +14,7 @@ module LocationsHelper
def local_authorities_selection def local_authorities_selection
null_option = [OpenStruct.new(id: "", name: "Select an option")] null_option = [OpenStruct.new(id: "", name: "Select an option")]
null_option + Location.local_authorities.map { |code, name| OpenStruct.new(code:, name:) } null_option + Location.local_authorities_for_current_year.map { |code, name| OpenStruct.new(code:, name:) }
end end
def selection_options(resource) def selection_options(resource)
@ -27,11 +27,11 @@ module LocationsHelper
base_attributes = [ base_attributes = [
{ name: "Postcode", value: location.postcode, attribute: "postcode" }, { name: "Postcode", value: location.postcode, attribute: "postcode" },
{ name: "Location name", value: location.name, attribute: "name" }, { name: "Location name", value: location.name, attribute: "name" },
{ name: "Local authority", value: location.location_admin_district, attribute: "local_authority" }, { name: "Local authority", value: formatted_local_authority_timeline(location, "name"), attribute: "local_authority" },
{ name: "Number of units", value: location.units, attribute: "units" }, { name: "Number of units", value: location.units, attribute: "units" },
{ name: "Most common unit", value: location.type_of_unit, attribute: "type_of_unit" }, { name: "Most common unit", value: location.type_of_unit, attribute: "type_of_unit" },
{ name: "Mobility standards", value: location.mobility_type, attribute: "mobility_standards" }, { name: "Mobility standards", value: location.mobility_type, attribute: "mobility_standards" },
{ name: "Location code", value: location.location_code, attribute: "location_code" }, { name: "Location code", value: formatted_local_authority_timeline(location, "code"), attribute: "location_code" },
{ name: "Availability", value: location_availability(location), attribute: "availability" }, { name: "Availability", value: location_availability(location), attribute: "availability" },
] ]
@ -46,7 +46,7 @@ module LocationsHelper
[ [
{ name: "Postcode", value: location.postcode, attribute: "postcode" }, { name: "Postcode", value: location.postcode, attribute: "postcode" },
{ name: "Location name", value: location.name, attribute: "name" }, { name: "Location name", value: location.name, attribute: "name" },
{ name: "Local authority", value: location.location_admin_district, attribute: "local_authority" }, { name: "Local authority", value: formatted_local_authority_timeline(location, "name"), attribute: "local_authority" },
{ name: "Number of units", value: location.units, attribute: "units" }, { name: "Number of units", value: location.units, attribute: "units" },
{ name: "Most common unit", value: location.type_of_unit, attribute: "type_of_unit" }, { name: "Most common unit", value: location.type_of_unit, attribute: "type_of_unit" },
{ name: "Mobility standards", value: location.mobility_type, attribute: "mobility_standards" }, { name: "Mobility standards", value: location.mobility_type, attribute: "mobility_standards" },
@ -107,4 +107,15 @@ private
[inner.deactivation_date, inner.reactivation_date].all? { |date| date.between?(outer.deactivation_date, outer.reactivation_date) } [inner.deactivation_date, inner.reactivation_date].all? { |date| date.between?(outer.deactivation_date, outer.reactivation_date) }
end end
def formatted_local_authority_timeline(location, field)
sorted_linked_authorities = location.linked_local_authorities.sort_by(&:start_date)
return sorted_linked_authorities.first[field] if sorted_linked_authorities.count == 1
sorted_linked_authorities.map { |linked_local_authority|
formatted_start_date = linked_local_authority.start_date.year == 2021 ? "until" : "#{linked_local_authority.start_date&.to_formatted_s(:govuk_date)} -"
formatted_end_date = linked_local_authority.end_date&.to_formatted_s(:govuk_date) || "present"
"#{linked_local_authority[field]} (#{formatted_start_date} #{formatted_end_date})"
}.join("\n")
end
end end

7
app/helpers/logs_helper.rb

@ -33,10 +33,9 @@ module LogsHelper
end end
end end
def csv_download_url_for_controller(controller) def csv_download_url_for_controller(controller_type:, search:, codes_only:)
case log_type_for_controller(controller) case log_type_for_controller(controller_type)
when "lettings" when "lettings" then csv_download_lettings_logs_path(search:, codes_only:)
csv_download_lettings_logs_path(search: params["search"])
end end
end end
end end

8
app/helpers/question_view_helper.rb

@ -7,15 +7,17 @@ module QuestionViewHelper
def legend(question, page_header, conditional) def legend(question, page_header, conditional)
{ {
text: question.header.html_safe, text: [question.question_number_string(conditional:), question.header.html_safe].compact.join(" - "),
size: label_size(page_header, conditional), size: label_size(page_header, conditional, question),
tag: label_tag(page_header, conditional), tag: label_tag(page_header, conditional),
} }
end end
private private
def label_size(page_header, conditional) def label_size(page_header, conditional, question)
return if question.plain_label.present?
page_header.blank? && !conditional ? "l" : "m" page_header.blank? && !conditional ? "l" : "m"
end end

4
app/jobs/email_csv_job.rb

@ -5,14 +5,14 @@ class EmailCsvJob < ApplicationJob
EXPIRATION_TIME = 3.hours.to_i EXPIRATION_TIME = 3.hours.to_i
def perform(user, search_term = nil, filters = {}, all_orgs = false, organisation = nil) # rubocop:disable Style/OptionalBooleanParameter - sidekiq can't serialise named params def perform(user, search_term = nil, filters = {}, all_orgs = false, organisation = nil, codes_only_export = false) # rubocop:disable Style/OptionalBooleanParameter - sidekiq can't serialise named params
unfiltered_logs = organisation.present? && user.support? ? LettingsLog.where(owning_organisation_id: organisation.id) : user.lettings_logs unfiltered_logs = organisation.present? && user.support? ? LettingsLog.where(owning_organisation_id: organisation.id) : user.lettings_logs
filtered_logs = FilterService.filter_logs(unfiltered_logs, search_term, filters, all_orgs, user) filtered_logs = FilterService.filter_logs(unfiltered_logs, search_term, filters, all_orgs, user)
filename = organisation.present? ? "logs-#{organisation.name}-#{Time.zone.now}.csv" : "logs-#{Time.zone.now}.csv" filename = organisation.present? ? "logs-#{organisation.name}-#{Time.zone.now}.csv" : "logs-#{Time.zone.now}.csv"
storage_service = Storage::S3Service.new(Configuration::EnvConfigurationService.new, ENV["CSV_DOWNLOAD_PAAS_INSTANCE"]) storage_service = Storage::S3Service.new(Configuration::EnvConfigurationService.new, ENV["CSV_DOWNLOAD_PAAS_INSTANCE"])
storage_service.write_file(filename, BYTE_ORDER_MARK + filtered_logs.to_csv(user)) storage_service.write_file(filename, BYTE_ORDER_MARK + filtered_logs.to_csv(user, codes_only_export:))
url = storage_service.get_presigned_url(filename, EXPIRATION_TIME) url = storage_service.get_presigned_url(filename, EXPIRATION_TIME)

15
app/mailers/bulk_upload_mailer.rb

@ -26,7 +26,7 @@ class BulkUploadMailer < NotifyMailer
{ {
title:, title:,
filename: bulk_upload.filename, filename: bulk_upload.filename,
upload_timestamp: bulk_upload.created_at, upload_timestamp: bulk_upload.created_at.to_fs(:govuk_date_and_time),
success_description:, success_description:,
logs_link: url, logs_link: url,
}, },
@ -73,11 +73,7 @@ class BulkUploadMailer < NotifyMailer
start_bulk_upload_sales_logs_url start_bulk_upload_sales_logs_url
end end
validator_class = if bulk_upload.lettings? row_parser_class = bulk_upload.prefix_namespace::RowParser
BulkUpload::Lettings::Validator
else
BulkUpload::Sales::Validator
end
errors = bulk_upload errors = bulk_upload
.bulk_upload_errors .bulk_upload_errors
@ -87,7 +83,7 @@ class BulkUploadMailer < NotifyMailer
.keys .keys
.sort_by { |_col, field| field } .sort_by { |_col, field| field }
.map do |col, field| .map do |col, field|
"- Column #{col} (#{validator_class.question_for_field(field.to_sym)})" "- #{row_parser_class.question_for_field(field.to_sym)} (Column #{col})"
end end
send_email( send_email(
@ -104,7 +100,7 @@ class BulkUploadMailer < NotifyMailer
) )
end end
def send_bulk_upload_failed_service_error_mail(bulk_upload:) def send_bulk_upload_failed_service_error_mail(bulk_upload:, errors: [])
bulk_upload_link = if bulk_upload.lettings? bulk_upload_link = if bulk_upload.lettings?
start_bulk_upload_lettings_logs_url start_bulk_upload_lettings_logs_url
else else
@ -116,9 +112,10 @@ class BulkUploadMailer < NotifyMailer
BULK_UPLOAD_FAILED_SERVICE_ERROR_TEMPLATE_ID, BULK_UPLOAD_FAILED_SERVICE_ERROR_TEMPLATE_ID,
{ {
filename: bulk_upload.filename, filename: bulk_upload.filename,
upload_timestamp: bulk_upload.created_at, upload_timestamp: bulk_upload.created_at.to_fs(:govuk_date_and_time),
lettings_or_sales: bulk_upload.log_type, lettings_or_sales: bulk_upload.log_type,
year_combo: bulk_upload.year_combo, year_combo: bulk_upload.year_combo,
errors: errors.map { |e| "- #{e}" }.join("\n"),
bulk_upload_link:, bulk_upload_link:,
}, },
) )

22
app/models/bulk_upload.rb

@ -46,6 +46,28 @@ class BulkUpload < ApplicationRecord
needstype == 2 needstype == 2
end end
def prefix_namespace
type_class = case log_type
when "lettings"
"Lettings"
when "sales"
"Sales"
else
raise "unknown log type"
end
year_class = case year
when 2022
"Year2022"
when 2023
"Year2023"
else
raise "unknown year"
end
"BulkUpload::#{type_class}::#{year_class}".constantize
end
private private
def generate_identifier def generate_identifier

9
app/models/derived_variables/sales_log_variables.rb

@ -23,6 +23,15 @@ module DerivedVariables::SalesLogVariables
self.totadult = total_adult + total_elder self.totadult = total_adult + total_elder
self.hhmemb = number_of_household_members self.hhmemb = number_of_household_members
self.hhtype = household_type self.hhtype = household_type
if uprn_known&.zero?
self.uprn = nil
end
if uprn_confirmed&.zero?
self.uprn = nil
self.uprn_known = 0
end
end end
private private

2
app/models/form.rb

@ -160,7 +160,7 @@ class Form
def invalidated_page_questions(log, current_user = nil) def invalidated_page_questions(log, current_user = nil)
# we're already treating these fields as a special case and reset their values upon saving a log # we're already treating these fields as a special case and reset their values upon saving a log
callback_questions = %w[postcode_known la ppcodenk previous_la_known prevloc postcode_full ppostcode_full location_id] callback_questions = %w[postcode_known la ppcodenk previous_la_known prevloc postcode_full ppostcode_full location_id address_line1 address_line2 town_or_city county]
questions.reject { |q| q.page.routed_to?(log, current_user) || q.derived? || callback_questions.include?(q.id) } || [] questions.reject { |q| q.page.routed_to?(log, current_user) || q.derived? || callback_questions.include?(q.id) } || []
end end

2
app/models/form/lettings/pages/lead_tenant_nationality.rb

@ -6,6 +6,6 @@ class Form::Lettings::Pages::LeadTenantNationality < ::Form::Page
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::National.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::Nationality.new(nil, nil, self)]
end end
end end

4
app/models/form/lettings/pages/max_rent_value_check.rb

@ -4,11 +4,11 @@ class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
@id = "max_rent_value_check" @id = "max_rent_value_check"
@depends_on = [{ "rent_in_soft_max_range?" => true }] @depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.rent.max.title_text", "translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{ "key" => "brent", "label" => true, "i18n_template" => "brent" }], "arguments" => [{ "key" => "brent", "label" => true, "i18n_template" => "brent" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.rent.max.hint_text", "translation" => "soft_validations.rent.max_hint_text",
"arguments" => [ "arguments" => [
{ {
"key" => "soft_max_for_period", "key" => "soft_max_for_period",

4
app/models/form/lettings/pages/min_rent_value_check.rb

@ -4,11 +4,11 @@ class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
@id = "min_rent_value_check" @id = "min_rent_value_check"
@depends_on = [{ "rent_in_soft_min_range?" => true }] @depends_on = [{ "rent_in_soft_min_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.rent.min.title_text", "translation" => "soft_validations.rent.outside_range_title",
"arguments" => [{ "key" => "brent", "label" => true, "i18n_template" => "brent" }], "arguments" => [{ "key" => "brent", "label" => true, "i18n_template" => "brent" }],
} }
@informative_text = { @informative_text = {
"translation" => "soft_validations.rent.min.hint_text", "translation" => "soft_validations.rent.min_hint_text",
"arguments" => [ "arguments" => [
{ {
"key" => "soft_min_for_period", "key" => "soft_min_for_period",

14
app/models/form/lettings/pages/person_age.rb

@ -1,15 +1,21 @@
class Form::Lettings::Pages::PersonAge < ::Form::Page class Form::Lettings::Pages::PersonAge < ::Form::Page
def initialize(id, hsh, subsection, person_index:) def initialize(id, hsh, subsection, person_index:, person_type: "non_child")
super(id, hsh, subsection) super(id, hsh, subsection)
@id = "person_#{person_index}_age" @id = "person_#{person_index}_age_#{person_type}"
@depends_on = [{ "details_known_#{person_index}" => 0 }]
@person_index = person_index @person_index = person_index
@person_type = person_type
@depends_on = [
{
"details_known_#{person_index}" => 0,
"person_#{person_index}_child_relation?" => (person_type == "child"),
},
]
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Lettings::Questions::AgeKnown.new(nil, nil, self, person_index: @person_index), Form::Lettings::Questions::AgeKnown.new(nil, nil, self, person_index: @person_index),
Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index), Form::Lettings::Questions::Age.new(nil, nil, self, person_index: @person_index, person_type: @person_type),
] ]
end end
end end

4
app/models/form/lettings/pages/previous_housing_situation.rb

@ -2,10 +2,10 @@ class Form::Lettings::Pages::PreviousHousingSituation < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "previous_housing_situation" @id = "previous_housing_situation"
@depends_on = [{ "renewal" => 0 }] @depends_on = [{ "is_renewal?" => false }]
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::Prevten.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::PreviousTenure.new(nil, nil, self)]
end end
end end

4
app/models/form/lettings/pages/previous_housing_situation_renewal.rb

@ -2,10 +2,10 @@ class Form::Lettings::Pages::PreviousHousingSituationRenewal < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "previous_housing_situation_renewal" @id = "previous_housing_situation_renewal"
@depends_on = [{ "renewal" => 1, "needstype" => 2 }] @depends_on = [{ "is_renewal?" => true, "is_supported_housing?" => true }]
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::PrevtenRenewal.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::PreviousTenureRenewal.new(nil, nil, self)]
end end
end end

2
app/models/form/lettings/pages/property_let_type.rb

@ -6,6 +6,6 @@ class Form::Lettings::Pages::PropertyLetType < ::Form::Page
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::Unitletas.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::PreviousLetType.new(nil, nil, self)]
end end
end end

6
app/models/form/lettings/pages/shelteredaccom.rb → app/models/form/lettings/pages/sheltered_accommodation.rb

@ -1,8 +1,8 @@
class Form::Lettings::Pages::Shelteredaccom < ::Form::Page class Form::Lettings::Pages::ShelteredAccommodation < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "shelteredaccom" @id = "sheltered_accommodation"
@depends_on = [{ "needstype" => 2 }] @depends_on = [{ "is_supported_housing?" => true }]
end end
def questions def questions

6
app/models/form/lettings/pages/starter_tenancy_type.rb

@ -2,13 +2,13 @@ class Form::Lettings::Pages::StarterTenancyType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "starter_tenancy_type" @id = "starter_tenancy_type"
@depends_on = [{ "startertenancy" => 1 }] @depends_on = [{ "starter_tenancy?" => true }]
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Lettings::Questions::StarterTenancy.new(nil, nil, self), Form::Lettings::Questions::StarterTenancyType.new(nil, nil, self),
Form::Lettings::Questions::Tenancyother.new(nil, nil, self), Form::Lettings::Questions::TenancyOther.new(nil, nil, self),
] ]
end end
end end

4
app/models/form/lettings/pages/tenancy_length.rb

@ -2,10 +2,10 @@ class Form::Lettings::Pages::TenancyLength < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_length" @id = "tenancy_length"
@depends_on = [{ "tenancy" => 4 }, { "tenancy" => 6 }, { "tenancy" => 3 }] @depends_on = [{ "tenancy_type_fixed_term?" => true }]
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::Tenancylength.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::TenancyLength.new(nil, nil, self)]
end end
end end

6
app/models/form/lettings/pages/tenancy_type.rb

@ -2,13 +2,13 @@ class Form::Lettings::Pages::TenancyType < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "tenancy_type" @id = "tenancy_type"
@depends_on = [{ "startertenancy" => 2 }] @depends_on = [{ "starter_tenancy?" => false }]
end end
def questions def questions
@questions ||= [ @questions ||= [
Form::Lettings::Questions::Tenancy.new(nil, nil, self), Form::Lettings::Questions::TenancyType.new(nil, nil, self),
Form::Lettings::Questions::Tenancyother.new(nil, nil, self), Form::Lettings::Questions::TenancyOther.new(nil, nil, self),
] ]
end end
end end

6
app/models/form/lettings/questions/age.rb

@ -1,5 +1,5 @@
class Form::Lettings::Questions::Age < ::Form::Question class Form::Lettings::Questions::Age < ::Form::Question
def initialize(id, hsh, page, person_index:) def initialize(id, hsh, page, person_index:, person_type:)
super(id, hsh, page) super(id, hsh, page)
@id = "age#{person_index}" @id = "age#{person_index}"
@check_answer_label = "Person #{person_index}’s age" @check_answer_label = "Person #{person_index}’s age"
@ -9,7 +9,9 @@ class Form::Lettings::Questions::Age < ::Form::Question
@inferred_check_answers_value = [{ "condition" => { "age#{person_index}_known" => 1 }, "value" => "Not known" }] @inferred_check_answers_value = [{ "condition" => { "age#{person_index}_known" => 1 }, "value" => "Not known" }]
@check_answers_card_number = person_index @check_answers_card_number = person_index
@max = 120 @max = 120
@min = 0 @min = 1
@step = 1 @step = 1
@hint_text = "For a child under 1, enter 1" if person_type == "child"
@question_number = 31 + (4 * person_index)
end end
end end

1
app/models/form/lettings/questions/age1.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::Age1 < ::Form::Question
@max = 120 @max = 120
@min = 16 @min = 16
@step = 1 @step = 1
@question_number = 32
end end
end end

1
app/models/form/lettings/questions/age1_known.rb

@ -10,6 +10,7 @@ class Form::Lettings::Questions::Age1Known < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "age1" => [0] } @conditional_for = { "age1" => [0] }
@hidden_in_check_answers = { "depends_on" => [{ "age1_known" => 0 }, { "age1_known" => 1 }] } @hidden_in_check_answers = { "depends_on" => [{ "age1_known" => 0 }, { "age1_known" => 1 }] }
@question_number = 32
end end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/age_known.rb

@ -15,6 +15,7 @@ class Form::Lettings::Questions::AgeKnown < ::Form::Question
{ "age#{person_index}_known" => 1 }, { "age#{person_index}_known" => 1 },
], ],
} }
@question_number = 31 + (4 * person_index)
end end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/armedforces.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Armedforces < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "This excludes national service.<br><br>If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner." @hint_text = "This excludes national service.<br><br>If there are several people in the household with links to the UK armed forces, you should answer for the regular. If there’s no regular, answer for the reserve. If there’s no reserve, answer for the spouse or civil partner."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 66
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/beds.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::Beds < ::Form::Question
@min = 0 @min = 0
@hint_text = "If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom." @hint_text = "If shared accommodation, enter the number of bedrooms occupied by this household. A bedsit has 1 bedroom."
@step = 1 @step = 1
@question_number = 22
end end
end end

1
app/models/form/lettings/questions/benefits.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Benefits < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "This excludes child and housing benefit, council tax support and tax credits." @hint_text = "This excludes child and housing benefit, council tax support and tax credits."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 90
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

2
app/models/form/lettings/questions/brent_4_weekly.rb

@ -12,8 +12,8 @@ class Form::Lettings::Questions::Brent4Weekly < ::Form::Question
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"
@hidden_in_check_answers = true
@prefix = "£" @prefix = "£"
@suffix = " every 4 weeks" @suffix = " every 4 weeks"
@question_number = 95
end end
end end

2
app/models/form/lettings/questions/brent_bi_weekly.rb

@ -12,8 +12,8 @@ class Form::Lettings::Questions::BrentBiWeekly < ::Form::Question
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"
@hidden_in_check_answers = true
@prefix = "£" @prefix = "£"
@suffix = " every 2 weeks" @suffix = " every 2 weeks"
@question_number = 95
end end
end end

2
app/models/form/lettings/questions/brent_monthly.rb

@ -12,8 +12,8 @@ class Form::Lettings::Questions::BrentMonthly < ::Form::Question
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"
@hidden_in_check_answers = true
@prefix = "£" @prefix = "£"
@suffix = " every month" @suffix = " every month"
@question_number = 95
end end
end end

2
app/models/form/lettings/questions/brent_weekly.rb

@ -12,8 +12,8 @@ class Form::Lettings::Questions::BrentWeekly < ::Form::Question
@step = 0.01 @step = 0.01
@fields_to_add = %w[brent scharge pscharge supcharg] @fields_to_add = %w[brent scharge pscharge supcharg]
@result_field = "tcharge" @result_field = "tcharge"
@hidden_in_check_answers = true
@prefix = "£" @prefix = "£"
@suffix = " every week" @suffix = " every week"
@question_number = 95
end end
end end

1
app/models/form/lettings/questions/builtype.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Builtype < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 20
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/chcharge_4_weekly.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::Chcharge4Weekly < ::Form::Question
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every 4 weeks" @suffix = " every 4 weeks"
@question_number = 94
end end
end end

1
app/models/form/lettings/questions/chcharge_bi_weekly.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::ChchargeBiWeekly < ::Form::Question
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every 2 weeks" @suffix = " every 2 weeks"
@question_number = 94
end end
end end

1
app/models/form/lettings/questions/chcharge_monthly.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::ChchargeMonthly < ::Form::Question
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every month" @suffix = " every month"
@question_number = 94
end end
end end

1
app/models/form/lettings/questions/chcharge_weekly.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::ChchargeWeekly < ::Form::Question
@step = 0.01 @step = 0.01
@prefix = "£" @prefix = "£"
@suffix = " every week" @suffix = " every week"
@question_number = 94
end end
end end

1
app/models/form/lettings/questions/condition_effects.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::ConditionEffects < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "Select all that apply." @hint_text = "Select all that apply."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 74
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

3
app/models/form/lettings/questions/declaration.rb

@ -3,11 +3,12 @@ class Form::Lettings::Questions::Declaration < ::Form::Question
super super
@id = "declaration" @id = "declaration"
@check_answer_label = "Tenant has seen the privacy notice" @check_answer_label = "Tenant has seen the privacy notice"
@header = "" @header = "Declaration"
@type = "checkbox" @type = "checkbox"
@check_answers_card_number = 0 @check_answers_card_number = 0
@guidance_partial = "privacy_notice_tenant" @guidance_partial = "privacy_notice_tenant"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 30
end end
ANSWER_OPTIONS = { "declaration" => { "value" => "The tenant has seen the DLUHC privacy notice" } }.freeze ANSWER_OPTIONS = { "declaration" => { "value" => "The tenant has seen the DLUHC privacy notice" } }.freeze

1
app/models/form/lettings/questions/earnings.rb

@ -17,5 +17,6 @@ class Form::Lettings::Questions::Earnings < ::Form::Question
{ "label" => " every month", "depends_on" => { "incfreq" => 2 } }, { "label" => " every month", "depends_on" => { "incfreq" => 2 } },
{ "label" => " every year", "depends_on" => { "incfreq" => 3 } }, { "label" => " every year", "depends_on" => { "incfreq" => 3 } },
] ]
@question_number = 88
end end
end end

1
app/models/form/lettings/questions/ethnic_arab.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicArab < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 35
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ethnic_asian.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicAsian < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 35
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ethnic_black.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicBlack < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 35
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ethnic_group.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicGroup < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 34
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ethnic_mixed.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicMixed < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 35
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ethnic_white.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::EthnicWhite < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 35
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/first_time_property_let_as_social_housing.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::FirstTimePropertyLetAsSocialHousing < ::Form::Q
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 14
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/gender_identity1.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::GenderIdentity1 < ::Form::Question
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 33
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/hb.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Hb < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 89
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/hbrentshortfall.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Hbrentshortfall < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "Also known as the ‘outstanding amount’." @hint_text = "Also known as the ‘outstanding amount’."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 99
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/hhmemb.rb

@ -11,5 +11,6 @@ class Form::Lettings::Questions::Hhmemb < ::Form::Question
@min = 1 @min = 1
@hint_text = "You can provide details for a maximum of 8 people." @hint_text = "You can provide details for a maximum of 8 people."
@step = 1 @step = 1
@question_number = 31
end end
end end

1
app/models/form/lettings/questions/homeless.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Homeless < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 79
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/household_charge.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::HouseholdCharge < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves." @hint_text = "If rent is charged on the property then answer Yes to this question, even if the tenants do not pay it themselves."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 91
end end
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/housingneeds.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Housingneeds < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 70
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/housingneeds_other.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::HousingneedsOther < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 72
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/housingneeds_type.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::HousingneedsType < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 71
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/illness.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Illness < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 73
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/incfreq.rb

@ -9,6 +9,7 @@ class Form::Lettings::Questions::Incfreq < ::Form::Question
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = true @hidden_in_check_answers = true
@question_number = 87
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/irproduct_other.rb

@ -5,5 +5,6 @@ class Form::Lettings::Questions::IrproductOther < ::Form::Question
@check_answer_label = "Product name" @check_answer_label = "Product name"
@header = "Name of rent product" @header = "Name of rent product"
@type = "text" @type = "text"
@question_number = 6
end end
end end

1
app/models/form/lettings/questions/is_carehome.rb

@ -9,6 +9,7 @@ class Form::Lettings::Questions::IsCarehome < ::Form::Question
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "chcharge" => [1] } @conditional_for = { "chcharge" => [1] }
@question_number = 93
end end
ANSWER_OPTIONS = { "0" => { "value" => "No" }, "1" => { "value" => "Yes" } }.freeze ANSWER_OPTIONS = { "0" => { "value" => "No" }, "1" => { "value" => "Yes" } }.freeze

1
app/models/form/lettings/questions/joint.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Joint < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 25
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

326
app/models/form/lettings/questions/la.rb

@ -3,330 +3,14 @@ class Form::Lettings::Questions::La < ::Form::Question
super super
@id = "la" @id = "la"
@check_answer_label = "Local Authority" @check_answer_label = "Local Authority"
@header = "What is the local authority of the property?" @header = "What is the property’s local authority?"
@type = "select" @type = "select"
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @question_number = 13
end end
ANSWER_OPTIONS = { def answer_options
"" => "Select an option", { "" => "Select an option" }.merge(LocalAuthority.active(form.start_date).england.map { |la| [la.code, la.name] }.to_h)
"E07000223" => "Adur", end
"E07000026" => "Allerdale",
"E07000032" => "Amber Valley",
"E07000224" => "Arun",
"E07000170" => "Ashfield",
"E07000105" => "Ashford",
"E07000200" => "Babergh",
"E09000002" => "Barking and Dagenham",
"E09000003" => "Barnet",
"E08000016" => "Barnsley",
"E07000027" => "Barrow-in-Furness",
"E07000066" => "Basildon",
"E07000084" => "Basingstoke and Deane",
"E07000171" => "Bassetlaw",
"E06000022" => "Bath and North East Somerset",
"E06000055" => "Bedford",
"E09000004" => "Bexley",
"E08000025" => "Birmingham",
"E07000129" => "Blaby",
"E06000008" => "Blackburn with Darwen",
"E06000009" => "Blackpool",
"E07000033" => "Bolsover",
"E08000001" => "Bolton",
"E07000136" => "Boston",
"E06000058" => "Bournemouth, Christchurch and Poole",
"E06000036" => "Bracknell Forest",
"E08000032" => "Bradford",
"E07000067" => "Braintree",
"E07000143" => "Breckland",
"E09000005" => "Brent",
"E07000068" => "Brentwood",
"E06000043" => "Brighton and Hove",
"E06000023" => "Bristol, City of",
"E07000144" => "Broadland",
"E09000006" => "Bromley",
"E07000234" => "Bromsgrove",
"E07000095" => "Broxbourne",
"E07000172" => "Broxtowe",
"E06000060" => "Buckinghamshire",
"E07000117" => "Burnley",
"E08000002" => "Bury",
"E08000033" => "Calderdale",
"E07000008" => "Cambridge",
"E09000007" => "Camden",
"E07000192" => "Cannock Chase",
"E07000106" => "Canterbury",
"E07000028" => "Carlisle",
"E07000069" => "Castle Point",
"E06000056" => "Central Bedfordshire",
"E07000130" => "Charnwood",
"E07000070" => "Chelmsford",
"E07000078" => "Cheltenham",
"E07000177" => "Cherwell",
"E06000049" => "Cheshire East",
"E06000050" => "Cheshire West and Chester",
"E07000034" => "Chesterfield",
"E07000225" => "Chichester",
"E07000118" => "Chorley",
"E09000001" => "City of London",
"E07000071" => "Colchester",
"E07000029" => "Copeland",
"E07000150" => "Corby",
"E06000052" => "Cornwall",
"E07000079" => "Cotswold",
"E06000047" => "County Durham",
"E08000026" => "Coventry",
"E07000163" => "Craven",
"E07000226" => "Crawley",
"E09000008" => "Croydon",
"E07000096" => "Dacorum",
"E06000005" => "Darlington",
"E07000107" => "Dartford",
"E07000151" => "Daventry",
"E06000015" => "Derby",
"E07000035" => "Derbyshire Dales",
"E08000017" => "Doncaster",
"E06000059" => "Dorset",
"E07000108" => "Dover",
"E08000027" => "Dudley",
"E09000009" => "Ealing",
"E07000009" => "East Cambridgeshire",
"E07000040" => "East Devon",
"E07000085" => "East Hampshire",
"E07000242" => "East Hertfordshire",
"E07000137" => "East Lindsey",
"E07000152" => "East Northamptonshire",
"E06000011" => "East Riding of Yorkshire",
"E07000193" => "East Staffordshire",
"E07000244" => "East Suffolk",
"E07000061" => "Eastbourne",
"E07000086" => "Eastleigh",
"E07000030" => "Eden",
"E07000207" => "Elmbridge",
"E09000010" => "Enfield",
"E07000072" => "Epping Forest",
"E07000208" => "Epsom and Ewell",
"E07000036" => "Erewash",
"E07000041" => "Exeter",
"E07000087" => "Fareham",
"E07000010" => "Fenland",
"E07000112" => "Folkestone and Hythe",
"E07000080" => "Forest of Dean",
"E07000119" => "Fylde",
"E08000037" => "Gateshead",
"E07000173" => "Gedling",
"E07000081" => "Gloucester",
"E07000088" => "Gosport",
"E07000109" => "Gravesham",
"E07000145" => "Great Yarmouth",
"E09000011" => "Greenwich",
"E07000209" => "Guildford",
"W06000002" => "Gwynedd",
"E09000012" => "Hackney",
"E06000006" => "Halton",
"E07000164" => "Hambleton",
"E09000013" => "Hammersmith and Fulham",
"E07000131" => "Harborough",
"E09000014" => "Haringey",
"E07000073" => "Harlow",
"E07000165" => "Harrogate",
"E09000015" => "Harrow",
"E07000089" => "Hart",
"E06000001" => "Hartlepool",
"E07000062" => "Hastings",
"E07000090" => "Havant",
"E09000016" => "Havering",
"E06000019" => "Herefordshire, County of",
"E07000098" => "Hertsmere",
"E07000037" => "High Peak",
"S12000017" => "Highland",
"E09000017" => "Hillingdon",
"E07000132" => "Hinckley and Bosworth",
"E07000227" => "Horsham",
"E09000018" => "Hounslow",
"E07000011" => "Huntingdonshire",
"E07000120" => "Hyndburn",
"E07000202" => "Ipswich",
"E06000046" => "Isle of Wight",
"E06000053" => "Isles of Scilly",
"E09000019" => "Islington",
"E09000020" => "Kensington and Chelsea",
"E07000153" => "Kettering",
"E07000146" => "King’s Lynn and West Norfolk",
"E06000010" => "Kingston upon Hull, City of",
"E09000021" => "Kingston upon Thames",
"E08000034" => "Kirklees",
"E08000011" => "Knowsley",
"E09000022" => "Lambeth",
"E07000121" => "Lancaster",
"E08000035" => "Leeds",
"E06000016" => "Leicester",
"E07000063" => "Lewes",
"E09000023" => "Lewisham",
"E07000194" => "Lichfield",
"E07000138" => "Lincoln",
"E08000012" => "Liverpool",
"E06000032" => "Luton",
"E07000110" => "Maidstone",
"E07000074" => "Maldon",
"E07000235" => "Malvern Hills",
"E08000003" => "Manchester",
"E07000174" => "Mansfield",
"E06000035" => "Medway",
"E07000133" => "Melton",
"E07000187" => "Mendip",
"E09000024" => "Merton",
"E07000042" => "Mid Devon",
"E07000203" => "Mid Suffolk",
"E07000228" => "Mid Sussex",
"E06000002" => "Middlesbrough",
"E06000042" => "Milton Keynes",
"E07000210" => "Mole Valley",
"E07000091" => "New Forest",
"E07000175" => "Newark and Sherwood",
"E08000021" => "Newcastle upon Tyne",
"E07000195" => "Newcastle-under-Lyme",
"E09000025" => "Newham",
"E07000043" => "North Devon",
"E07000038" => "North East Derbyshire",
"E06000012" => "North East Lincolnshire",
"E07000099" => "North Hertfordshire",
"E07000139" => "North Kesteven",
"E06000013" => "North Lincolnshire",
"E07000147" => "North Norfolk",
"E06000024" => "North Somerset",
"E08000022" => "North Tyneside",
"E07000218" => "North Warwickshire",
"E07000134" => "North West Leicestershire",
"E07000154" => "Northampton",
"E06000057" => "Northumberland",
"E07000148" => "Norwich",
"E06000018" => "Nottingham",
"E07000219" => "Nuneaton and Bedworth",
"E07000135" => "Oadby and Wigston",
"E08000004" => "Oldham",
"E07000178" => "Oxford",
"E07000122" => "Pendle",
"E06000031" => "Peterborough",
"E06000026" => "Plymouth",
"E06000044" => "Portsmouth",
"E07000123" => "Preston",
"E06000038" => "Reading",
"E09000026" => "Redbridge",
"E06000003" => "Redcar and Cleveland",
"E07000236" => "Redditch",
"E07000211" => "Reigate and Banstead",
"E07000124" => "Ribble Valley",
"E09000027" => "Richmond upon Thames",
"E07000166" => "Richmondshire",
"E08000005" => "Rochdale",
"E07000075" => "Rochford",
"E07000125" => "Rossendale",
"E07000064" => "Rother",
"E08000018" => "Rotherham",
"E07000220" => "Rugby",
"E07000212" => "Runnymede",
"E07000176" => "Rushcliffe",
"E07000092" => "Rushmoor",
"E06000017" => "Rutland",
"E07000167" => "Ryedale",
"E08000006" => "Salford",
"E08000028" => "Sandwell",
"E07000168" => "Scarborough",
"E07000188" => "Sedgemoor",
"E08000014" => "Sefton",
"E07000169" => "Selby",
"E07000111" => "Sevenoaks",
"E08000019" => "Sheffield",
"E06000051" => "Shropshire",
"E06000039" => "Slough",
"E08000029" => "Solihull",
"E07000246" => "Somerset West and Taunton",
"E07000012" => "South Cambridgeshire",
"E07000039" => "South Derbyshire",
"E06000025" => "South Gloucestershire",
"E07000044" => "South Hams",
"E07000140" => "South Holland",
"E07000141" => "South Kesteven",
"E07000031" => "South Lakeland",
"E07000149" => "South Norfolk",
"E07000155" => "South Northamptonshire",
"E07000179" => "South Oxfordshire",
"E07000126" => "South Ribble",
"E07000189" => "South Somerset",
"E07000196" => "South Staffordshire",
"E08000023" => "South Tyneside",
"E06000045" => "Southampton",
"E06000033" => "Southend-on-Sea",
"E09000028" => "Southwark",
"E07000213" => "Spelthorne",
"E07000240" => "St Albans",
"E08000013" => "St. Helens",
"E07000197" => "Stafford",
"E07000198" => "Staffordshire Moorlands",
"E07000243" => "Stevenage",
"E08000007" => "Stockport",
"E06000004" => "Stockton-on-Tees",
"E06000021" => "Stoke-on-Trent",
"E07000221" => "Stratford-on-Avon",
"E07000082" => "Stroud",
"E08000024" => "Sunderland",
"E07000214" => "Surrey Heath",
"E09000029" => "Sutton",
"E07000113" => "Swale",
"E06000030" => "Swindon",
"E08000008" => "Tameside",
"E07000199" => "Tamworth",
"E07000215" => "Tandridge",
"E07000045" => "Teignbridge",
"E06000020" => "Telford and Wrekin",
"E07000076" => "Tendring",
"E07000093" => "Test Valley",
"E07000083" => "Tewkesbury",
"E07000114" => "Thanet",
"E07000102" => "Three Rivers",
"E06000034" => "Thurrock",
"E07000115" => "Tonbridge and Malling",
"E06000027" => "Torbay",
"E07000046" => "Torridge",
"E09000030" => "Tower Hamlets",
"E08000009" => "Trafford",
"E07000116" => "Tunbridge Wells",
"E07000077" => "Uttlesford",
"E07000180" => "Vale of White Horse",
"E08000036" => "Wakefield",
"E08000030" => "Walsall",
"E09000031" => "Waltham Forest",
"E09000032" => "Wandsworth",
"E06000007" => "Warrington",
"E07000222" => "Warwick",
"E07000103" => "Watford",
"E07000216" => "Waverley",
"E07000065" => "Wealden",
"E07000156" => "Wellingborough",
"E07000241" => "Welwyn Hatfield",
"E06000037" => "West Berkshire",
"E07000047" => "West Devon",
"E07000127" => "West Lancashire",
"E07000142" => "West Lindsey",
"E07000181" => "West Oxfordshire",
"E07000245" => "West Suffolk",
"E09000033" => "Westminster",
"E08000010" => "Wigan",
"E06000054" => "Wiltshire",
"E07000094" => "Winchester",
"E06000040" => "Windsor and Maidenhead",
"E08000015" => "Wirral",
"E07000217" => "Woking",
"E06000041" => "Wokingham",
"E08000031" => "Wolverhampton",
"E07000237" => "Worcester",
"E07000229" => "Worthing",
"E07000238" => "Wychavon",
"E07000128" => "Wyre",
"E07000239" => "Wyre Forest",
"E06000014" => "York",
}.freeze
end end

1
app/models/form/lettings/questions/layear.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Layear < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 75
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/leftreg.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Leftreg < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 67
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/letting_allocation.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "Select all that apply." @hint_text = "Select all that apply."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 84
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/location_id.rb

@ -10,6 +10,7 @@ class Form::Lettings::Questions::LocationId < ::Form::Question
"needstype": 2, "needstype": 2,
}, },
} }
@question_number = 10
end end
def answer_options def answer_options

1
app/models/form/lettings/questions/majorrepairs.rb

@ -9,6 +9,7 @@ class Form::Lettings::Questions::Majorrepairs < ::Form::Question
@hint_text = "Major repairs are works that could not be reasonably carried out with a tenant living at the property. For example, structural repairs." @hint_text = "Major repairs are works that could not be reasonably carried out with a tenant living at the property. For example, structural repairs."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "mrcdate" => [1] } @conditional_for = { "mrcdate" => [1] }
@question_number = 24
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/managing_organisation.rb

@ -5,6 +5,7 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question
@check_answer_label = "Managing agent" @check_answer_label = "Managing agent"
@header = "Which organisation manages this letting?" @header = "Which organisation manages this letting?"
@type = "select" @type = "select"
@question_number = 2
end end
def answer_options(log = nil, user = nil) def answer_options(log = nil, user = nil)

1
app/models/form/lettings/questions/mrcdate.rb

@ -7,5 +7,6 @@ class Form::Lettings::Questions::Mrcdate < ::Form::Question
@type = "date" @type = "date"
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "For example, 27 3 2021." @hint_text = "For example, 27 3 2021."
@question_number = 24
end end
end end

7
app/models/form/lettings/questions/national.rb → app/models/form/lettings/questions/nationality.rb

@ -1,19 +1,22 @@
class Form::Lettings::Questions::National < ::Form::Question class Form::Lettings::Questions::Nationality < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "national" @id = "national"
@check_answer_label = "Lead tenant’s nationality" @check_answer_label = "Lead tenant’s nationality"
@header = "What is the lead tenant’s nationality?" @header = "What is the nationality of the lead tenant?"
@type = "radio" @type = "radio"
@check_answers_card_number = 1 @check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest." @hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 36
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"18" => { "value" => "United Kingdom" }, "18" => { "value" => "United Kingdom" },
"17" => { "value" => "Republic of Ireland" }, "17" => { "value" => "Republic of Ireland" },
"19" => { "value" => "European Economic Area (EEA) country, excluding Ireland" }, "19" => { "value" => "European Economic Area (EEA) country, excluding Ireland" },
"20" => { "value" => "Afghanistan" },
"21" => { "value" => "Ukraine" },
"12" => { "value" => "Other" }, "12" => { "value" => "Other" },
"divider" => true, "divider" => true,
"13" => { "value" => "Tenant prefers not to say" }, "13" => { "value" => "Tenant prefers not to say" },

1
app/models/form/lettings/questions/needs_type.rb

@ -7,6 +7,7 @@ class Form::Lettings::Questions::NeedsType < ::Form::Question
@hint_text = "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes." @hint_text = "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes."
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 3
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/net_income_known.rb

@ -9,6 +9,7 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question
@guidance_partial = "what_counts_as_income" @guidance_partial = "what_counts_as_income"
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 86
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

7
app/models/form/lettings/questions/offered.rb

@ -2,14 +2,15 @@ class Form::Lettings::Questions::Offered < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "offered" @id = "offered"
@check_answer_label = "Times previously offered since becoming available" @check_answer_label = I18n.t("check_answer_labels.offered")
@header = "Since becoming available for re-let, how many times has the property been previously offered?" @header = I18n.t("questions.offered")
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@check_answers_card_number = 0 @check_answers_card_number = 0
@max = 150 @max = 150
@min = 0 @min = 0
@hint_text = "This is after the last tenancy ended. If the property is being offered for let for the first time, enter 0." @hint_text = I18n.t("hints.offered")
@step = 1 @step = 1
@question_number = 18
end end
end end

7
app/models/form/lettings/questions/offered_social_let.rb

@ -2,14 +2,15 @@ class Form::Lettings::Questions::OfferedSocialLet < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "offered" @id = "offered"
@check_answer_label = "Times previously offered since becoming available" @check_answer_label = I18n.t("check_answer_labels.offered")
@header = "How many times was the property offered between becoming vacant and this letting?" @header = I18n.t("questions.offered")
@type = "numeric" @type = "numeric"
@width = 2 @width = 2
@check_answers_card_number = 0 @check_answers_card_number = 0
@max = 150 @max = 150
@min = 0 @min = 0
@hint_text = "Do not include the offer that led to this letting.This is after the last tenancy ended. If the property is being offered for let for the first time, enter 0." @hint_text = I18n.t("hints.offered")
@step = 1 @step = 1
@question_number = 18
end end
end end

1
app/models/form/lettings/questions/period.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::Period < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 92
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/person_gender_identity.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::PersonGenderIdentity < ::Form::Question
@check_answers_card_number = person_index @check_answers_card_number = person_index
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 32 + (4 * person_index)
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

3
app/models/form/lettings/questions/person_relationship.rb

@ -8,13 +8,14 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question
@check_answers_card_number = person_index @check_answers_card_number = person_index
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 30 + (4 * person_index)
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"P" => { "value" => "Partner" }, "P" => { "value" => "Partner" },
"C" => { "C" => {
"value" => "Child", "value" => "Child",
"hint" => "Must be eligible for child benefit, aged under 16 or under 20 if still in full-time education.", "hint" => "Must be eligible for child benefit: under age 16 or under 20 if still in full-time education.",
}, },
"X" => { "value" => "Other" }, "X" => { "value" => "Other" },
"divider" => { "value" => true }, "divider" => { "value" => true },

1
app/models/form/lettings/questions/person_working_situation.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::PersonWorkingSituation < ::Form::Question
@check_answers_card_number = person_index @check_answers_card_number = person_index
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 33 + (4 * person_index)
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/ppcodenk.rb

@ -10,6 +10,7 @@ class Form::Lettings::Questions::Ppcodenk < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "ppostcode_full" => [1] } @conditional_for = { "ppostcode_full" => [1] }
@hidden_in_check_answers = { "depends_on" => [{ "ppcodenk" => 0 }, { "ppcodenk" => 1 }] } @hidden_in_check_answers = { "depends_on" => [{ "ppcodenk" => 0 }, { "ppcodenk" => 1 }] }
@question_number = 80
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze

1
app/models/form/lettings/questions/ppostcode_full.rb

@ -10,5 +10,6 @@ class Form::Lettings::Questions::PpostcodeFull < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@inferred_answers = { "prevloc" => { "is_previous_la_inferred" => true } } @inferred_answers = { "prevloc" => { "is_previous_la_inferred" => true } }
@question_number = 80
end end
end end

1
app/models/form/lettings/questions/preg_occ.rb

@ -8,6 +8,7 @@ class Form::Lettings::Questions::PregOcc < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 69
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {

1
app/models/form/lettings/questions/previous_la_known.rb

@ -10,6 +10,7 @@ class Form::Lettings::Questions::PreviousLaKnown < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@conditional_for = { "prevloc" => [1] } @conditional_for = { "prevloc" => [1] }
@hidden_in_check_answers = { "depends_on" => [{ "previous_la_known" => 0 }, { "previous_la_known" => 1 }] } @hidden_in_check_answers = { "depends_on" => [{ "previous_la_known" => 0 }, { "previous_la_known" => 1 }] }
@question_number = 81
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "0" => { "value" => "No" } }.freeze

8
app/models/form/lettings/questions/unitletas.rb → app/models/form/lettings/questions/previous_let_type.rb

@ -1,4 +1,4 @@
class Form::Lettings::Questions::Unitletas < ::Form::Question class Form::Lettings::Questions::PreviousLetType < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "unitletas" @id = "unitletas"
@ -8,12 +8,16 @@ class Form::Lettings::Questions::Unitletas < ::Form::Question
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "" @hint_text = ""
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 16
end end
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"1" => { "value" => "Social rent basis" }, "1" => { "value" => "Social rent basis" },
"2" => { "value" => "Affordable rent basis" }, "2" => { "value" => "Affordable rent basis" },
"4" => { "value" => "Intermediate rent basis" }, "5" => { "value" => "A London Affordable Rent basis" },
"6" => { "value" => "A Rent to Buy basis" },
"7" => { "value" => "A London Living Rent basis" },
"8" => { "value" => "Another Intermediate Rent basis" },
"divider" => { "value" => true }, "divider" => { "value" => true },
"3" => { "value" => "Don’t know" }, "3" => { "value" => "Don’t know" },
}.freeze }.freeze

42
app/models/form/lettings/questions/previous_tenure.rb

@ -0,0 +1,42 @@
class Form::Lettings::Questions::PreviousTenure < ::Form::Question
def initialize(id, hsh, page)
super
@id = "prevten"
@check_answer_label = "Where was the household immediately before this letting?"
@header = "Where was the household immediately before this letting?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "This is where the household was the night before they moved."
@answer_options = ANSWER_OPTIONS
@question_number = 78
end
ANSWER_OPTIONS = {
"30" => { "value" => "Fixed-term local authority general needs tenancy" },
"32" => { "value" => "Fixed-term private registered provider (PRP) general needs tenancy" },
"31" => { "value" => "Lifetime local authority general needs tenancy" },
"33" => { "value" => "Lifetime private registered provider (PRP) general needs tenancy" },
"34" => { "value" => "Specialist retirement housing" },
"36" => { "value" => "Sheltered housing for adults aged under 55 years" },
"35" => { "value" => "Extra care housing" },
"6" => { "value" => "Other supported housing" },
"3" => { "value" => "Private sector tenancy" },
"27" => { "value" => "Owner occupation (low-cost home ownership)" },
"26" => { "value" => "Owner occupation (private)" },
"28" => { "value" => "Living with friends or family" },
"14" => { "value" => "Bed and breakfast" },
"7" => { "value" => "Direct access hostel" },
"10" => { "value" => "Hospital" },
"29" => { "value" => "Prison or approved probation hostel" },
"19" => { "value" => "Rough sleeping" },
"18" => { "value" => "Any other temporary accommodation" },
"13" => { "value" => "Children’s home or foster care" },
"24" => { "value" => "Home Office Asylum Support" },
"37" => { "value" => "Host family or similar refugee accommodation" },
"23" => { "value" => "Mobile home or caravan" },
"21" => { "value" => "Refuge" },
"9" => { "value" => "Residential care home" },
"4" => { "value" => "Tied housing or rented with job" },
"25" => { "value" => "Any other accommodation" },
}.freeze
end

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save