diff --git a/Gemfile.lock b/Gemfile.lock
index 322fcc403..2964e3830 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -232,6 +232,8 @@ GEM
minitest (5.14.4)
msgpack (1.4.2)
nio4r (2.5.8)
+ nokogiri (1.12.5-x86_64-darwin)
+ racc (~> 1.4)
nokogiri (1.12.5-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb
index d34a22623..43cea56b2 100644
--- a/app/admin/case_logs.rb
+++ b/app/admin/case_logs.rb
@@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
permit_params do
- permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armedforces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known]
+ permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armedforces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known]
permitted
end
diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb
index 7a1c01b19..4cd0a82e7 100644
--- a/app/constants/db_enums.rb
+++ b/app/constants/db_enums.rb
@@ -10,6 +10,22 @@ module DbEnums
}
end
+ def self.unitletas
+ {
+ "Social rent basis" => 1,
+ "Affordable rent basis" => 2,
+ "Intermediate rent basis" => 4,
+ "Do not know" => 3,
+ }
+ end
+
+ def self.builtype
+ {
+ "Purpose built" => 1,
+ "Conversion" => 2
+ }
+ end
+
def self.ecstat
{
"Part-time - Less than 30 hours" => 2,
@@ -186,17 +202,17 @@ module DbEnums
"First let of newbuild property" => 15,
"First let of conversion/rehabilitation/acquired property" => 16,
"First let of leased property" => 17,
- "Relet - tenant evicted due to arrears" => 10,
- "Relet - tenant evicted due to ASB or other reason" => 11,
- "Relet - tenant died (no succession)" => 5,
- "Relet - tenant moved to other social housing provider" => 12,
- "Relet - tenant abandoned property" => 6,
- "Relet - tenant moved to private sector or other accommodation" => 8,
- "Relet - to tenant who occupied same property as temporary accommodation" => 9,
- "Relet – internal transfer (excluding renewals of a fixed-term tenancy)" => 13,
- "Relet – renewal of fixed-term tenancy" => 14,
- "Relet – tenant moved to care home" => 18,
- "Relet – tenant involved in a succession downsize" => 19,
+ "Tenant evicted due to arrears" => 10,
+ "Tenant evicted due to ASB or other reason" => 11,
+ "Tenant died (no succession)" => 5,
+ "Tenant moved to other social housing provider" => 12,
+ "Tenant abandoned property" => 6,
+ "Tenant moved to private sector or other accommodation" => 8,
+ "Relet to tenant who occupied same property as temporary accommodation" => 9,
+ "Internal transfer (excluding renewals of a fixed-term tenancy)" => 13,
+ "Renewal of fixed-term tenancy" => 14,
+ "Tenant moved to care home" => 18,
+ "Tenant involved in a succession downsize" => 19,
}
end
diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb
index 0b55c7c1f..48e546236 100644
--- a/app/controllers/case_logs_controller.rb
+++ b/app/controllers/case_logs_controller.rb
@@ -64,7 +64,8 @@ class CaseLogsController < ApplicationController
redirect_path = form.next_page_redirect_path(page, @case_log)
redirect_to(send(redirect_path, @case_log))
else
- render "form/page", locals: { form: form, page: page }, status: :unprocessable_entity
+ subsection = form.subsection_for_page(page)
+ render "form/page", locals: { form: form, page: page, subsection: subsection.label }, status: :unprocessable_entity
end
end
@@ -92,7 +93,8 @@ class CaseLogsController < ApplicationController
form.pages.map do |page|
define_method(page.id) do |_errors = {}|
@case_log = CaseLog.find(params[:case_log_id])
- render "form/page", locals: { form: form, page: page }
+ subsection = form.subsection_for_page(page)
+ render "form/page", locals: { form: form, page: page, subsection: subsection.label }
end
end
diff --git a/app/models/case_log.rb b/app/models/case_log.rb
index 40a717997..5f638cfa4 100644
--- a/app/models/case_log.rb
+++ b/app/models/case_log.rb
@@ -110,8 +110,11 @@ class CaseLog < ApplicationRecord
enum hbrentshortfall: DbEnums.polar_with_unknown, _suffix: true
enum property_relet: DbEnums.polar, _suffix: true
enum armedforces: DbEnums.armed_forces, _suffix: true
+ enum first_time_property_let_as_social_housing: DbEnums.polar, _suffix: true
+ enum unitletas: DbEnums.unitletas, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze
+ OPTIONAL_FIELDS = %w[do_you_know_the_postcode do_you_know_the_local_authority].freeze
def self.editable_fields
attribute_names - AUTOGENERATED_FIELDS
@@ -221,7 +224,7 @@ private
end
def mandatory_fields
- required = attributes.except(*AUTOGENERATED_FIELDS)
+ required = attributes.except(*(AUTOGENERATED_FIELDS + OPTIONAL_FIELDS))
dynamically_not_required = []
diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb
index 96ad4b5de..c87ce14f0 100644
--- a/app/views/case_logs/edit.html.erb
+++ b/app/views/case_logs/edit.html.erb
@@ -1,7 +1,7 @@
<%= turbo_frame_tag "case_log_form", target: "_top" do %>
-
Tasklist for log
+ Tasklist for log
<%= @case_log.id %>
This submission is
diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb
index ea3d45436..ef1bc3975 100644
--- a/app/views/case_logs/index.html.erb
+++ b/app/views/case_logs/index.html.erb
@@ -1,6 +1,6 @@
-
Your logs
+ Your logs
diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb
index f02e7fb3f..b327e94d2 100644
--- a/app/views/form/_checkbox_question.html.erb
+++ b/app/views/form/_checkbox_question.html.erb
@@ -1,5 +1,5 @@
<%= f.govuk_check_boxes_fieldset question.id.to_sym,
- legend: { text: question.header.html_safe, size: "l" },
+ legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text } do %>
<% question.answer_options.map do |key, val| %>
diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb
index 032f9a7c5..61eb34b2a 100644
--- a/app/views/form/_date_question.html.erb
+++ b/app/views/form/_date_question.html.erb
@@ -1,6 +1,6 @@
<%= f.govuk_date_field question.id.to_sym,
hint: { text: question.hint_text },
- legend: { text: question.header.html_safe, size: "l"},
+ legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
width: 20,
**stimulus_html_attributes(question)
%>
diff --git a/app/views/form/_numeric_question.html.erb b/app/views/form/_numeric_question.html.erb
index ff6237318..5a75c46c8 100644
--- a/app/views/form/_numeric_question.html.erb
+++ b/app/views/form/_numeric_question.html.erb
@@ -1,6 +1,6 @@
<%= f.govuk_number_field question.id.to_sym,
hint: { text: question.hint_text },
- label: { text: question.header.html_safe, size: "l"},
+ label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
min: question.min, max: question.max, step: question.step,
width: 20, :readonly => question.read_only?,
**stimulus_html_attributes(question)
diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb
index 2c96f5391..a922fc3e0 100644
--- a/app/views/form/_radio_question.html.erb
+++ b/app/views/form/_radio_question.html.erb
@@ -1,5 +1,5 @@
<%= f.govuk_radio_buttons_fieldset question.id.to_sym,
- legend: { text: question.header.html_safe, size: "l" },
+ legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text },
small: (question.answer_options.size > 5) do %>
diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb
index 4e43a3d84..b6c431286 100644
--- a/app/views/form/_select_question.html.erb
+++ b/app/views/form/_select_question.html.erb
@@ -3,6 +3,6 @@
answers,
:name,
:name,
- label: { text: question.header},
+ label: { text: question.header, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text }
%>
diff --git a/app/views/form/_text_question.html.erb b/app/views/form/_text_question.html.erb
index 50e9f6dec..c062b7e62 100644
--- a/app/views/form/_text_question.html.erb
+++ b/app/views/form/_text_question.html.erb
@@ -1,6 +1,6 @@
<%= f.govuk_text_field question.id.to_sym,
hint: { text: question.hint_text },
- label: { text: question.header.html_safe, size: "l"},
+ label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
width: 20,
**stimulus_html_attributes(question)
%>
diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb
index 3aa77fc77..0eee408e7 100644
--- a/app/views/form/page.html.erb
+++ b/app/views/form/page.html.erb
@@ -5,8 +5,11 @@
<%= turbo_frame_tag "case_log_form", target: "_top" do %>
+
+ <%= subsection %>
+
<% if page.header.present? %>
-
+
<%= page.header %>
<% end %>
@@ -14,7 +17,7 @@
<%= f.govuk_error_summary %>
<% page.questions.map do |question| %>
<%= display_question_key_div(page, question) %> >
- <%= render partial: "form/#{question.type}_question", locals: { question: question, f: f } %>
+ <%= render partial: "form/#{question.type}_question", locals: { question: question, page_header: page.header, f: f } %>
<% end %>
diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json
index 24d3e367d..0b62cef59 100644
--- a/config/forms/2021_2022.json
+++ b/config/forms/2021_2022.json
@@ -87,8 +87,8 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": "Yes",
- "1": "No"
+ "0": "No",
+ "1": "Yes"
}
}
},
@@ -1107,13 +1107,66 @@
"label": "Property information",
"depends_on": { "about_this_log": "completed" },
"pages": {
- "property_location": {
+ "property_reference": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "propcode": {
+ "check_answer_label": "What’s the property reference?",
+ "header": "What's the property reference?",
+ "hint_text": "",
+ "type": "text"
+ }
+ }
+ },
+ "property_postcode": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "do_you_know_the_postcode": {
+ "check_answer_label": "Do you know the property postcode?",
+ "header": "Do you know the postcode?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": "No",
+ "1": "Yes"
+ },
+ "conditional_for": {
+ "postcode": ["Yes"]
+ }
+ },
+ "postcode": {
+ "check_answer_label": "",
+ "header": "",
+ "hint_text": "",
+ "type": "text"
+ }
+ }
+ },
+ "do_you_know_the_local_authority": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "do_you_know_the_local_authority": {
+ "check_answer_label": "Do you know what local authority the property is located in?",
+ "header": "Do you know what local authority the property is located in?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": "No",
+ "1": "Yes"
+ }
+ }
+ }
+ },
+ "select_local_authority": {
"header": "",
"description": "",
"questions": {
"la": {
- "check_answer_label": "Property Location",
- "header": "Property location",
+ "check_answer_label": "Local Authority",
+ "header": "Select a local authority",
"hint_text": "",
"type": "radio",
"answer_options": {
@@ -1432,37 +1485,59 @@
"312": "York"
}
}
- }
+ },
+ "depends_on": { "do_you_know_the_local_authority": "Yes" }
},
- "property_postcode": {
+ "why_dont_you_know_la": {
"header": "",
"description": "",
"questions": {
- "property_postcode": {
- "check_answer_label": "What was the previous postcode?",
- "header": "What is the property's postcode?",
+ "why_dont_you_know_la": {
+ "check_answer_label": "Reason for not knowing local authority",
+ "header": "Give a reason why you don't know the postcode or local authority",
"hint_text": "",
"type": "text"
}
- }
+ },
+ "depends_on": { "do_you_know_the_local_authority": "No" }
},
- "property_relet": {
+ "first_time_property_let_as_social_housing": {
"header": "",
"description": "",
"questions": {
- "property_relet": {
+ "first_time_property_let_as_social_housing": {
"check_answer_label": "Which type was the property most recently let as?",
"header": "Is this property a relet?",
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": "Yes",
- "1": "No"
+ "0": "No",
+ "1": "Yes"
}
}
- }
+ },
+ "depends_on": { "tenant_same_property_renewal": "No"}
},
- "property_vacancy_reason": {
+ "unitletas": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "unitletas": {
+ "check_answer_label": "Type property most recently let as",
+ "header": "Which type was the property most recently let as?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": "Social rent basis",
+ "1": "Affordable rent basis",
+ "2": "Intermediate rent basis",
+ "3": "Do not know"
+ }
+ }
+ },
+ "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" }
+ },
+ "property_vacancy_reason_not_first_let": {
"header": "",
"description": "",
"questions": {
@@ -1471,36 +1546,72 @@
"header": "What is the reason for the property vacancy?",
"hint_text": "",
"type": "radio",
- "answer_options": {
- "0": "First let of newbuild property",
- "1": "First let of conversion/rehabilitation/acquired property",
- "2": "First let of leased property",
- "3": "Relet - tenant evicted due to arrears",
- "4": "Relet - tenant evicted due to ASB or other reason",
- "5": "Relet - tenant died (no succession)",
- "6": "Relet - tenant moved to other social housing provider",
- "7": "Relet - tenant abandoned property",
- "8": "Relet - tenant moved to private sector or other accommodation",
- "9": "Relet - to tenant who occupied same property as temporary accommodation",
- "10": "Relet – internal transfer (excluding renewals of a fixed-term tenancy)",
- "11": "Relet – renewal of fixed-term tenancy",
- "12": "Relet – tenant moved to care home",
- "13": "Relet – tenant involved in a succession downsize"
+ "answer_options": {
+ "0": "Renewal of fixed-term tenancy",
+ "1": "Internal transfer (excluding renewals of a fixed-term tenancy)",
+ "2": "Relet to tenant who occupied same property as temporary accommodation",
+ "3": "Tenant involved in a succession downsize",
+ "4": "Tenant moved to private sector or other accommodation",
+ "5": "Tenant moved to other social housing provider",
+ "6": "Tenant moved to care home",
+ "7": "Tenant abandoned property",
+ "8": "Tenant evicted due to arrears",
+ "9": "Tenant evicted due to ASB or other reason",
+ "10": "Previous tenant passed away (no succession)"
}
}
- }
+ },
+ "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" }
},
- "property_reference": {
+ "property_vacancy_reason_first_let": {
"header": "",
"description": "",
"questions": {
- "propcode": {
- "check_answer_label": "What’s the property reference?",
- "header": "What's the property reference?",
+ "rsnvac": {
+ "check_answer_label": "What is the reason for the property vacancy?",
+ "header": "What is the reason for the property vacancy?",
"hint_text": "",
- "type": "text"
+ "type": "radio",
+ "answer_options": {
+ "11": "First let of newbuild property",
+ "12": "First let of conversion/rehabilitation/acquired property",
+ "13": "First let of leased property"
+ }
}
- }
+ },
+ "depends_on": { "first_time_property_let_as_social_housing": "Yes", "tenant_same_property_renewal": "No" }
+ },
+ "property_number_of_times_relet_not_social_let": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "offered": {
+ "check_answer_label": "How many times has this unit been previously offered since becoming available for relet since becoming available for relet (after the last tenancy ended)?",
+ "header": "How many times has this unit been previously offered since becoming available for relet since becoming available for relet (after the last tenancy ended)?",
+ "hint_text": "If the property is being let for the first time, enter 0",
+ "type": "numeric",
+ "min": 0,
+ "max": 150,
+ "step": 1
+ }
+ },
+ "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" }
+ },
+ "property_number_of_times_relet_social_let": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "offered": {
+ "check_answer_label": "How many times has the property been previously offered since becoming available?",
+ "header": "How many times has the property been previously offered since becoming available?",
+ "hint_text": "If the property is being let for the first time, enter 0",
+ "type": "numeric",
+ "min": 0,
+ "max": 150,
+ "step": 1
+ }
+ },
+ "depends_on": { "first_time_property_let_as_social_housing": "Yes", "tenant_same_property_renewal": "No" }
},
"property_unit_type": {
"header": "",
@@ -1524,6 +1635,38 @@
}
}
},
+ "property_building_type": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "builtype": {
+ "check_answer_label": "Building type",
+ "header": "Which type of building is the property?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": "Purpose built",
+ "1": "Converted from previous residential or non-residential property"
+ }
+ }
+ }
+ },
+ "property_wheelchair_accessible": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "wchair": {
+ "check_answer_label": "Is property built or adapted to wheelchair user standards?",
+ "header": "Is property built or adapted to wheelchair user standards?",
+ "hint_text": "",
+ "type": "radio",
+ "answer_options": {
+ "0": "Yes",
+ "1": "No"
+ }
+ }
+ }
+ },
"property_number_of_bedrooms": {
"header": "",
"description": "",
@@ -1537,7 +1680,21 @@
"max": 150,
"step": 1
}
- }
+ },
+ "depends_on": { "needstype": "General Needs" }
+ },
+ "void_or_renewal_date": {
+ "header": "",
+ "description": "",
+ "questions": {
+ "beds": {
+ "check_answer_label": "void/renewal date",
+ "header": "What is the void or renewal date?",
+ "hint_text": "",
+ "type": "date"
+ }
+ },
+ "depends_on": { "rsnvac": "First let of newbuild property", "tenant_same_property_renewal": "No" }
},
"property_major_repairs": {
"header": "",
@@ -1549,12 +1706,13 @@
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": "Yes",
- "1": "No"
+ "0": "No",
+ "1": "Yes"
},
"conditional_for": {
"mrcdate": ["Yes"]
- }
+ },
+ "depends_on": { "tenant_same_property_renewal": "No" }
},
"mrcdate": {
"check_answer_label": "What was the major repairs completion date?",
@@ -1562,35 +1720,28 @@
"hint_text": "For example, 27 3 2007",
"type": "date"
}
- }
- },
- "property_number_of_times_relet": {
- "header": "",
- "description": "",
- "questions": {
- "offered": {
- "check_answer_label": "How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let?",
- "header": "How many times has this unit been previously offered since becoming available for relet since the last tenancy ended or as a first let? ",
- "hint_text": "For an Affordable Rent or Intermediate Rent Letting, only include number of offers as that type. For a property let at the first attempt enter '0' ",
- "type": "numeric",
- "min": 0,
- "max": 150,
- "step": 1
- }
- }
+ },
+ "depends_on": { "rsnvac": "First let of newbuild property" }
},
- "property_wheelchair_accessible": {
+ "new_build_handover_date": {
"header": "",
"description": "",
"questions": {
- "wchair": {
- "check_answer_label": "Is property built or adapted to wheelchair user standards?",
- "header": "Is property built or adapted to wheelchair user standards?",
+ "majorrepairs": {
+ "check_answer_label": "Were major repairs carried out during the void period?",
+ "header": "Were any major repairs completed during the void period?",
"hint_text": "",
"type": "radio",
"answer_options": {
- "0": "Yes",
- "1": "No"
+ "0": "No",
+ "1": "Yesx"
+ },
+ "conditional_for": {
+ "mrcdate": ["Yes"]
+ },
+ "depends_on": {
+ "tenant_same_property_renewal": "No",
+ "rsnvac": ["First let of conversion, rehabilitation or acquired property?", "First let of leased property"]
}
}
}
diff --git a/db/migrate/20211119104835_add_property_info_fields.rb b/db/migrate/20211119104835_add_property_info_fields.rb
new file mode 100644
index 000000000..c4f900a91
--- /dev/null
+++ b/db/migrate/20211119104835_add_property_info_fields.rb
@@ -0,0 +1,10 @@
+class AddPropertyInfoFields < ActiveRecord::Migration[6.1]
+ def change
+ change_table :case_logs, bulk: true do |t|
+ t.column :first_time_property_let_as_social_housing, :int
+ t.column :why_dont_you_know_la, :string
+ t.column :type_property_most_recently_let_as, :string
+ t.column :builtype, :string
+ end
+ end
+end
diff --git a/db/migrate/20211124152204_change_recently_let_as_to_enum.rb b/db/migrate/20211124152204_change_recently_let_as_to_enum.rb
new file mode 100644
index 000000000..d5cddce59
--- /dev/null
+++ b/db/migrate/20211124152204_change_recently_let_as_to_enum.rb
@@ -0,0 +1,19 @@
+class ChangeRecentlyLetAsToEnum < ActiveRecord::Migration[6.1]
+ def up
+ change_table :case_logs, bulk: true do |t|
+ t.remove :type_property_most_recently_let_as
+ t.column :unitletas, :int
+ t.remove :builtype
+ t.column :builtype, :int
+ end
+ end
+
+ def down
+ change_table :case_logs, bulk: true do |t|
+ t.remove :unitletas
+ t.column :type_property_most_recently_let_as, :string
+ t.remove :builtype
+ t.remove :builtype, :string
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index dc5154c56..f3120334b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2021_11_19_120910) do
+ActiveRecord::Schema.define(version: 2021_11_24_152204) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -35,6 +35,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do
t.integer "ethnic"
t.integer "national"
t.integer "prevten"
+ t.string "armed_forces"
t.integer "ecstat1"
t.integer "hhmemb"
t.string "relat2"
@@ -69,6 +70,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do
t.integer "underoccupation_benefitcap"
t.integer "leftreg"
t.integer "reservist"
+ t.string "armed_forces_partner"
t.integer "illness"
t.integer "preg_occ"
t.string "accessibility_requirements"
@@ -163,6 +165,11 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do
t.datetime "sale_completion_date"
t.datetime "startdate"
t.integer "armedforces"
+ t.string "property_postcode"
+ t.integer "first_time_property_let_as_social_housing"
+ t.string "why_dont_you_know_la"
+ t.integer "unitletas"
+ t.integer "builtype"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
end
diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json
index 53837c5df..b7d0c44c7 100644
--- a/docs/api/DLUHC-CORE-Data.v1.json
+++ b/docs/api/DLUHC-CORE-Data.v1.json
@@ -317,7 +317,7 @@
"property_building_type": "dummy",
"beds": 3,
"property_void_date": "03/11/2019",
- "majorrepairs": "Yes",
+ "majorrepairs": "No",
"mrcdate": "05/05/2020",
"offered": 2,
"wchair": true,
diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb
index 03a4ba314..393a2042e 100644
--- a/spec/factories/case_log.rb
+++ b/spec/factories/case_log.rb
@@ -54,7 +54,7 @@ FactoryBot.define do
lettype { "Affordable Rent - General Needs" }
landlord { "This landlord" }
previous_postcode { "SE2 6RT" }
- rsnvac { "Relet - tenant abandoned property" }
+ rsnvac { "Tenant abandoned property" }
unittype_gn { "House" }
property_building_type { "dummy" }
beds { 3 }
diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json
index fe8393178..a1bcea38b 100644
--- a/spec/fixtures/complete_case_log.json
+++ b/spec/fixtures/complete_case_log.json
@@ -7,6 +7,8 @@
"national": "UK national resident in UK",
"prevten": "Private sector tenancy",
"armedforces": "A current or former regular in the UK Armed Forces (exc. National Service)",
+ "armed_forces": "A current or former regular in the UK Armed Forces (exc. National Service)",
+ "armed_forces_partner": "",
"ecstat1": "Full-time - 30 hours or more",
"other_hhmemb": 7,
"hhmemb": 8,
@@ -57,13 +59,13 @@
"la": "Barnet",
"property_postcode": "NW1 5TY",
"property_relet": "No",
- "rsnvac": "Relet - tenant abandoned property",
+ "rsnvac": "First let of newbuild property",
"property_reference": "P9876",
"unittype_gn": "House",
"property_building_type": "dummy",
"beds": 3,
"property_void_date": "03/11/2019",
- "majorrepairs": "Yes",
+ "majorrepairs": "No",
"mrcdate": "05/05/2020",
"mrcday": 5,
"mrcmonth": 5,
@@ -124,7 +126,6 @@
"property_owner_organisation": "",
"property_manager_organisation": "",
"sale_or_letting": "",
- "tenant_same_property_renewal": "",
"rent_type": "",
"intermediate_rent_product_name": "",
"needs_type": "",
@@ -134,6 +135,14 @@
"postcode": "a1",
"postcod2": "w3",
"ppostc1": "w3",
- "ppostc2": "w3"
+ "ppostc2": "w3",
+ "why_dont_you_know_la": "Forgot",
+ "first_time_property_let_as_social_housing": "Yes",
+ "unitletas": "Affordable rent basis",
+ "builtype": "Purpose built",
+ "property_wheelchair_accessible": "Yes",
+ "void_or_renewal_date": "05/05/2020",
+ "tenant_same_property_renewal": "Yes",
+ "new_build_handover_date": "01/01/2019"
}
}
diff --git a/spec/fixtures/forms/test_aboutthislog.json b/spec/fixtures/forms/test_aboutthislog.json
deleted file mode 100644
index 798469487..000000000
--- a/spec/fixtures/forms/test_aboutthislog.json
+++ /dev/null
@@ -1,179 +0,0 @@
-{
- "form_type": "lettings",
- "sections": {
- "about_this_log": {
- "label": "About this log",
- "subsections": {
- "about_this_log": {
- "label": "About this log",
- "pages": {
- "gdpr_acceptance": {
- "header": "DLUHC Privacy Notice Acceptance",
- "description": "",
- "questions": {
- "gdpr_acceptance": {
- "check_answer_label": "GDPR acceptance",
- "header": "Has the tenant or buyer seen the DLUHC privacy notice?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": "Yes",
- "1": "No"
- }
- }
- },
- "conditional_route_to": {
- "organisation_details": { "gdpr_acceptance": "Yes" }
- }
- },
- "gdpr_declined": {
- "header": "You cannot use this service",
- "hint_text": "",
- "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.",
- "questions": {
-
- }
- },
- "organisation_details": {
- "header": "About this log",
- "description": "Organisation Details",
- "questions": {
- "property_owner_organisation": {
- "check_answer_label": "",
- "header": "Which organisation owns this property?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": "A",
- "1": "B"
- }
- },
- "property_manager_organisation": {
- "check_answer_label": "",
- "header": "Which organisation manages this property?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": "A",
- "1": "B"
- }
- }
- }
- },
- "sale_or_letting": {
- "header": "About this log",
- "description": "Is this a sale or a letting?",
- "questions": {
- "sale_or_letting": {
- "check_answer_label": "",
- "header": "Is this a sale or a letting?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": "Sale",
- "1": "Letting"
- }
- }
- }
- },
- "tenant_same_property_renewal": {
- "header": "About this log",
- "description": "Is this a renewal to the same tenant in the same property?",
- "questions": {
- "tenant_same_property_renewal": {
- "check_answer_label": "",
- "header": "Is this a renewal to the same tenant in the same property?",
- "hint_text": "",
- "type": "radio",
- "answer_options": {
- "0": "Yes",
- "1": "No"
- }
- }
- },
- "depends_on": { "sale_or_letting": "Letting" }
- },
- "tenancy_start_date": {
- "header": "About this log",
- "description": "",
- "questions": {
- "tenancy_start_date": {
- "check_answer_label": "When is the tenancy start date?",
- "header": "What is the tenancy start date?",
- "hint_text": "For example, 27 3 2007",
- "type": "date"
- }
- },
- "depends_on": { "sale_or_letting": "Letting" }
- },
- "letting_type": {
- "header": "About this log",
- "description": "",
- "questions": {
- "rent_type": {
- "check_answer_label": "What is the rent type?",
- "header": "What is the rent type?",
- "hint_text": "",
- "type": "select",
- "answer_options": {
- "0": "Social Rent",
- "1": "Affordable Rent",
- "2": "London Affordable Rent",
- "3": "Rent To Buy",
- "4": "London Living Rent",
- "5": "Other Intermediate Rent Product"
- },
- "conditional_for": {
- "intermediate_rent_product_name": ["Other Intermediate Rent Product"]
- }
- },
- "intermediate_rent_product_name": {
- "check_answer_label": "Enter the product name",
- "header": "What is intermediate rent product name?",
- "type": "text"
- },
- "needs_type": {
- "check_answer_label": "What is the needs type?",
- "header": "What is the needs type?",
- "hint_text": "",
- "type": "select",
- "answer_options": {
- "0": "Supported Housing",
- "1": "General Needs"
- }
- }
- },
- "depends_on": { "sale_or_letting": "Letting" }
- },
- "sale_completion_date": {
- "header": "About this log",
- "description": "",
- "questions": {
- "sale_completion_date": {
- "check_answer_label": "What is the sale completion date?",
- "header": "What is the sale completion date?",
- "hint_text": "For example, 27 3 2007",
- "type": "date"
- }
- },
- "depends_on": { "sale_or_letting": "Sale" }
- },
- "purchaser_code": {
- "header": "About this log",
- "description": "",
- "questions": {
- "purchaser_code": {
- "check_answer_label": "What is the purchaser code?",
- "header": "What is the purchaser code?",
- "hint_text": "",
- "type": "text"
- }
- },
- "depends_on": { "sale_or_letting": "Sale" }
- }
- }
- }
- }
- }
- }
-}
diff --git a/spec/lib/tasks/form_definition_validator_spec.rb b/spec/lib/tasks/form_definition_validator_spec.rb
index e08b69f58..6cbfc5178 100644
--- a/spec/lib/tasks/form_definition_validator_spec.rb
+++ b/spec/lib/tasks/form_definition_validator_spec.rb
@@ -11,7 +11,7 @@ describe "rake form_definition:validate_all", type: :task do
end
it "runs the validate task for each form definition in the project" do
- expect(Rake::Task["form_definition:validate"]).to receive(:invoke).exactly(4).times
+ expect(Rake::Task["form_definition:validate"]).to receive(:invoke).exactly(3).times
task.invoke
end
end