From a9a14724ccc3f1e320def28cb7b965223c856d7b Mon Sep 17 00:00:00 2001 From: magicmilo Date: Mon, 15 Nov 2021 15:39:48 +0000 Subject: [PATCH 01/22] initial --- config/forms/2021_2022.json | 103 ++++++++++++++++++++----- config/forms/property_information.json | 17 ++++ 2 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 config/forms/property_information.json diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 859e5fa14..0f59cad7f 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1127,13 +1127,69 @@ "property_information": { "label": "Property information", "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": "Yes", + "1": "No" + }, + "conditional_for": { + "property_postcode": ["Yes"] + } + }, + "property_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": "Yes", + "1": "No" + } + } + }, + "conditional_route_to": { + "why_dont_you_know_la": { "do_you_know_the_local_authority": "No" } + } + }, + "select_local_authority": { "header": "", "description": "", "questions": { - "la": { - "check_answer_label": "Property Location", - "header": "Property location", + "select_local_authority": { + "check_answer_label": "Local Authority", + "header": "Select a local authority", "hint_text": "", "type": "radio", "answer_options": { @@ -1454,16 +1510,35 @@ } } }, - "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" } + }, + "conditional_route_to": { + "organisation_details": { "do_you_know_the_local_authority": "No" } + } + }, + "first_time_property_let_as_social_housing": { + "header": "", + "description": "", + "questions": { + "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" + } + } } }, "property_relet": { @@ -1510,18 +1585,6 @@ } } }, - "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_unit_type": { "header": "", "description": "", diff --git a/config/forms/property_information.json b/config/forms/property_information.json new file mode 100644 index 000000000..e808bdd46 --- /dev/null +++ b/config/forms/property_information.json @@ -0,0 +1,17 @@ +{ + "form_type": "lettings", + "start_year": 2021, + "end_year": 2022, + "sections": { + "property_information": { + "label": "Property Information", + "subsections": { + "about_this_log": { + "label": "About this log", + "pages": { + } + } + } + } + } +} \ No newline at end of file From ebf0d5dddb0db204b27f03ba2b6dc6e2b75811ff Mon Sep 17 00:00:00 2001 From: magicmilo Date: Tue, 16 Nov 2021 17:42:43 +0000 Subject: [PATCH 02/22] intial --- config/forms/2021_2022.json | 126 ++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 50 deletions(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 62dd50fc3..5be33f2ae 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1520,7 +1520,8 @@ "312": "York" } } - } + }, + "default_next_page": "first_time_property_let_as_social_housing" }, "why_dont_you_know_la": { "header": "", @@ -1532,9 +1533,6 @@ "hint_text": "", "type": "text" } - }, - "conditional_route_to": { - "organisation_details": { "do_you_know_the_local_authority": "No" } } }, "first_time_property_let_as_social_housing": { @@ -1578,25 +1576,40 @@ "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)", + "11": "First let of newbuild property", + "12": "First let of conversion/rehabilitation/acquired property", + "13": "First let of leased property" } } } }, + "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 + } + } + }, "property_unit_type": { "header": "", "description": "", @@ -1619,54 +1632,46 @@ } } }, - "property_number_of_bedrooms": { + "property_building_type": { "header": "", "description": "", "questions": { - "beds": { - "check_answer_label": "How many bedrooms are there in the property?", - "header": "How many bedrooms are there in the property?", - "hint_text": "If shared accommodation, enter number of bedrooms occupied by this household; a bed-sit has 1 bedroom", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1 + "": { + "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_major_repairs": { + "property_wheelchair_accessible": { "header": "", "description": "", "questions": { - "majorrepairs": { - "check_answer_label": "Were major repairs carried out during the void period?", - "header": "Were any major repairs completed during the void period?", + "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" - }, - "conditional_for": { - "mrcdate": ["Yes"] } - }, - "mrcdate": { - "check_answer_label": "What was the major repairs completion date?", - "header": "What was the major repairs completion date?", - "hint_text": "For example, 27 3 2007", - "type": "date" } } }, - "property_number_of_times_relet": { + "property_number_of_bedrooms": { "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' ", + "beds": { + "check_answer_label": "How many bedrooms are there in the property?", + "header": "How many bedrooms are there in the property?", + "hint_text": "If shared accommodation, enter number of bedrooms occupied by this household; a bed-sit has 1 bedroom", "type": "numeric", "min": 0, "max": 150, @@ -1674,19 +1679,40 @@ } } }, - "property_wheelchair_accessible": { + "void_or_renewal_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?", + "beds": { + "check_answer_label": "void/renewal date", + "header": "What is the void or renewal date?", + "hint_text": "", + "type": "date" + } + } + }, + "property_major_repairs": { + "header": "", + "description": "", + "questions": { + "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" + }, + "conditional_for": { + "mrcdate": ["Yes"] } + }, + "mrcdate": { + "check_answer_label": "What was the major repairs completion date?", + "header": "What was the major repairs completion date?", + "hint_text": "For example, 27 3 2007", + "type": "date" } } } From 3d729c1823d6489cfb86727b7f124707abe4e751 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Tue, 16 Nov 2021 19:45:40 +0000 Subject: [PATCH 03/22] remove test json --- config/forms/property_information.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 config/forms/property_information.json diff --git a/config/forms/property_information.json b/config/forms/property_information.json deleted file mode 100644 index e808bdd46..000000000 --- a/config/forms/property_information.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "form_type": "lettings", - "start_year": 2021, - "end_year": 2022, - "sections": { - "property_information": { - "label": "Property Information", - "subsections": { - "about_this_log": { - "label": "About this log", - "pages": { - } - } - } - } - } -} \ No newline at end of file From 9647a3e56250c5adf06867878a777d88e8928079 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 18 Nov 2021 16:24:09 +0000 Subject: [PATCH 04/22] Add in the depends_on --- config/forms/2021_2022.json | 73 ++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 66caacf75..499728a88 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1131,7 +1131,7 @@ "property_postcode": ["Yes"] } }, - "property_postcode": { + "postcode": { "check_answer_label": "", "header": "", "hint_text": "", @@ -1484,7 +1484,7 @@ } } }, - "default_next_page": "first_time_property_let_as_social_housing" + "depends_on": { "do_you_know_the_local_authority": "Yes" } }, "why_dont_you_know_la": { "header": "", @@ -1496,7 +1496,8 @@ "hint_text": "", "type": "text" } - } + }, + "depends_on": { "do_you_know_the_local_authority": "No" } }, "first_time_property_let_as_social_housing": { "header": "", @@ -1514,21 +1515,24 @@ } } }, - "property_relet": { + "type_property_most_recently_let_as": { "header": "", "description": "", "questions": { - "property_relet": { - "check_answer_label": "Which type was the property most recently let as?", - "header": "Is this property a relet?", + "type_property_most_recently_let_as": { + "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": "Yes", - "1": "No" + "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" } }, "property_vacancy_reason": { "header": "", @@ -1550,10 +1554,24 @@ "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)", + "10": "Previous tenant passed away (no succession)" + } + } + } + }, + "property_vacancy_reason": { + "header": "", + "description": "", + "questions": { + "rsnvac": { + "check_answer_label": "What is the reason for the property vacancy?", + "header": "What is the reason for the property vacancy?", + "hint_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" + "13": "First let of leased property" } } } @@ -1563,15 +1581,32 @@ "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' ", + "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" } + }, + "property_number_of_times_relet": { + "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" } }, "property_unit_type": { "header": "", @@ -1652,7 +1687,8 @@ "hint_text": "", "type": "date" } - } + }, + "depends_on": { "rsnvac": "First let of newbuild property" } }, "property_major_repairs": { "header": "", @@ -1677,7 +1713,8 @@ "hint_text": "For example, 27 3 2007", "type": "date" } - } + }, + "depends_on": { "rsnvac": "First let of newbuild property" } } } } From 8ba2cd26b361d5e337885b916cf7c8854f30905b Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 18 Nov 2021 16:37:34 +0000 Subject: [PATCH 05/22] more json --- Gemfile.lock | 3 +++ config/forms/2021_2022.json | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 04961facf..e4a47433d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -225,6 +225,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) overcommit (0.58.0) @@ -383,6 +385,7 @@ GEM zeitwerk (2.5.1) PLATFORMS + x86_64-darwin-20 x86_64-linux DEPENDENCIES diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 499728a88..c1e47fdac 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1534,7 +1534,7 @@ }, "depends_on": { "first_time_property_let_as_social_housing": "No" } }, - "property_vacancy_reason": { + "property_vacancy_reason_not_first_let": { "header": "", "description": "", "questions": { @@ -1557,9 +1557,10 @@ "10": "Previous tenant passed away (no succession)" } } - } + }, + "depends_on": { "first_time_property_let_as_social_housing": "No" } }, - "property_vacancy_reason": { + "property_vacancy_reason_first_let": { "header": "", "description": "", "questions": { @@ -1574,9 +1575,10 @@ "13": "First let of leased property" } } - } + }, + "depends_on": { "first_time_property_let_as_social_housing": "Yes" } }, - "property_number_of_times_relet": { + "property_number_of_times_relet_not_social_let": { "header": "", "description": "", "questions": { @@ -1592,7 +1594,7 @@ }, "depends_on": { "first_time_property_let_as_social_housing": "No" } }, - "property_number_of_times_relet": { + "property_number_of_times_relet_social_let": { "header": "", "description": "", "questions": { From 0ba94c9266d0ae15e55e3e5518fd7d59e9db264c Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 09:55:43 +0000 Subject: [PATCH 06/22] remove conditional_route_to --- config/forms/2021_2022.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index c1e47fdac..32b8440e1 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1123,6 +1123,7 @@ "header": "do_you_know_the_postcode?", "hint_text": "", "type": "radio", + "store": "false", "answer_options": { "0": "Yes", "1": "No" @@ -1153,9 +1154,6 @@ "1": "No" } } - }, - "conditional_route_to": { - "why_dont_you_know_la": { "do_you_know_the_local_authority": "No" } } }, "select_local_authority": { From 667902e5ab57a0112032528a4b04a5072f3e392a Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 12:04:29 +0000 Subject: [PATCH 07/22] add renewal general needs routing --- config/forms/2021_2022.json | 50 ++++++++++++++----- ...20211119104835_add_property_info_fields.rb | 12 +++++ db/schema.rb | 11 +++- 3 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20211119104835_add_property_info_fields.rb diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 32b8440e1..c5c60fa46 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1123,7 +1123,6 @@ "header": "do_you_know_the_postcode?", "hint_text": "", "type": "radio", - "store": "false", "answer_options": { "0": "Yes", "1": "No" @@ -1160,7 +1159,7 @@ "header": "", "description": "", "questions": { - "select_local_authority": { + "la": { "check_answer_label": "Local Authority", "header": "Select a local authority", "hint_text": "", @@ -1510,7 +1509,8 @@ "0": "Yes", "1": "No" } - } + }, + "depends_on": { "renewal": "Not Renewal"} } }, "type_property_most_recently_let_as": { @@ -1530,7 +1530,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } }, "property_vacancy_reason_not_first_let": { "header": "", @@ -1556,7 +1556,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } }, "property_vacancy_reason_first_let": { "header": "", @@ -1574,7 +1574,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } }, "property_number_of_times_relet_not_social_let": { "header": "", @@ -1590,7 +1590,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } }, "property_number_of_times_relet_social_let": { "header": "", @@ -1606,7 +1606,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } }, "property_unit_type": { "header": "", @@ -1634,7 +1634,7 @@ "header": "", "description": "", "questions": { - "": { + "builtype": { "check_answer_label": "Building type", "header": "Which type of building is the property?", "hint_text": "", @@ -1675,7 +1675,8 @@ "max": 150, "step": 1 } - } + }, + "depends_on": { "needstype": "General Needs" } }, "void_or_renewal_date": { "header": "", @@ -1688,7 +1689,7 @@ "type": "date" } }, - "depends_on": { "rsnvac": "First let of newbuild property" } + "depends_on": { "rsnvac": "First let of newbuild property", "renewal": "Not Renewal" } }, "property_major_repairs": { "header": "", @@ -1705,7 +1706,8 @@ }, "conditional_for": { "mrcdate": ["Yes"] - } + }, + "depends_on": { "renewal": "Not Renewal" } }, "mrcdate": { "check_answer_label": "What was the major repairs completion date?", @@ -1715,6 +1717,30 @@ } }, "depends_on": { "rsnvac": "First let of newbuild property" } + }, + "new_build_handover_date": { + "header": "", + "description": "", + "questions": { + "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" + }, + "conditional_for": { + "mrcdate": ["Yes"] + }, + "depends_on": { + "renewal": "Not Renewal", + "rsnvac": "First let of conversion, rehabilitation or acquired property?", + "rsnvac": "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..78362fe2a --- /dev/null +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -0,0 +1,12 @@ +class AddPropertyInfoFields < ActiveRecord::Migration[6.1] + def change + change_table :case_logs, bulk: true do |t| + t.column :do_you_know_the_postcode, :integer + t.column :do_you_know_the_local_authority, :integer + t.column :why_dont_you_know_la, :string + t.column :first_time_property_let_as_social_housing, :integer + t.column :type_property_most_recently_let_as, :integer + t.column :builtype, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 72f15b7b2..9b4b2a4bd 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_18_090831) do +ActiveRecord::Schema.define(version: 2021_11_19_104835) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -25,6 +25,7 @@ ActiveRecord::Schema.define(version: 2021_11_18_090831) do t.integer "ethnic" t.integer "national" t.integer "prevten" + t.string "armed_forces" t.integer "ecstat1" t.integer "hhmemb" t.string "relat2" @@ -59,6 +60,7 @@ ActiveRecord::Schema.define(version: 2021_11_18_090831) 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" @@ -152,7 +154,12 @@ ActiveRecord::Schema.define(version: 2021_11_18_090831) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.integer "armedforces" + t.integer "do_you_know_the_postcode" + t.integer "do_you_know_the_local_authority" + t.string "why_dont_you_know_la" + t.integer "first_time_property_let_as_social_housing" + t.integer "type_property_most_recently_let_as" + t.integer "builtype" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end From c7a63e46b8fb44bbf8bf77c18a7ec08b19a1a505 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 15:45:11 +0000 Subject: [PATCH 08/22] change column types --- app/models/form.rb | 1 + config/forms/2021_2022.json | 28 +++++++++---------- db/migrate/20211119142809_change_renewal.rb | 7 +++++ .../20211119154133_change_column_types.rb | 21 ++++++++++++++ db/schema.rb | 14 +++++----- 5 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 db/migrate/20211119142809_change_renewal.rb create mode 100644 db/migrate/20211119154133_change_column_types.rb diff --git a/app/models/form.rb b/app/models/form.rb index 34385af99..195a51f69 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -108,6 +108,7 @@ class Form end def page_routed_to?(page, case_log) + # binding.pry return true unless (conditions = page_dependencies(page)) conditions.all? do |question, value| diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index c5c60fa46..e12961300 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -81,7 +81,7 @@ "header": "About this log", "description": "Is this a renewal to the same tenant in the same property?", "questions": { - "tenant_same_property_renewal": { + "renewal": { "check_answer_label": "", "header": "Is this a renewal to the same tenant in the same property?", "hint_text": "", @@ -1120,7 +1120,7 @@ "questions": { "do_you_know_the_postcode": { "check_answer_label": "Do you know the property postcode?", - "header": "do_you_know_the_postcode?", + "header": "Do you know the postcode?", "hint_text": "", "type": "radio", "answer_options": { @@ -1128,7 +1128,7 @@ "1": "No" }, "conditional_for": { - "property_postcode": ["Yes"] + "postcode": ["Yes"] } }, "postcode": { @@ -1509,9 +1509,9 @@ "0": "Yes", "1": "No" } - }, - "depends_on": { "renewal": "Not Renewal"} - } + } + }, + "depends_on": { "renewal": "No"} }, "type_property_most_recently_let_as": { "header": "", @@ -1530,7 +1530,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } }, "property_vacancy_reason_not_first_let": { "header": "", @@ -1556,7 +1556,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } }, "property_vacancy_reason_first_let": { "header": "", @@ -1574,7 +1574,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" } }, "property_number_of_times_relet_not_social_let": { "header": "", @@ -1590,7 +1590,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } }, "property_number_of_times_relet_social_let": { "header": "", @@ -1606,7 +1606,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" } }, "property_unit_type": { "header": "", @@ -1689,7 +1689,7 @@ "type": "date" } }, - "depends_on": { "rsnvac": "First let of newbuild property", "renewal": "Not Renewal" } + "depends_on": { "rsnvac": "First let of newbuild property", "renewal": "No" } }, "property_major_repairs": { "header": "", @@ -1707,7 +1707,7 @@ "conditional_for": { "mrcdate": ["Yes"] }, - "depends_on": { "renewal": "Not Renewal" } + "depends_on": { "renewal": "No" } }, "mrcdate": { "check_answer_label": "What was the major repairs completion date?", @@ -1735,7 +1735,7 @@ "mrcdate": ["Yes"] }, "depends_on": { - "renewal": "Not Renewal", + "renewal": "No", "rsnvac": "First let of conversion, rehabilitation or acquired property?", "rsnvac": "First let of leased property" } diff --git a/db/migrate/20211119142809_change_renewal.rb b/db/migrate/20211119142809_change_renewal.rb new file mode 100644 index 000000000..f8c244600 --- /dev/null +++ b/db/migrate/20211119142809_change_renewal.rb @@ -0,0 +1,7 @@ +class ChangeRenewal < ActiveRecord::Migration[6.1] + def change + rename_column :case_logs, :tenant_same_property_renewal, :renewal + end +end + + diff --git a/db/migrate/20211119154133_change_column_types.rb b/db/migrate/20211119154133_change_column_types.rb new file mode 100644 index 000000000..75c1c05b8 --- /dev/null +++ b/db/migrate/20211119154133_change_column_types.rb @@ -0,0 +1,21 @@ +class ChangeColumnTypes < ActiveRecord::Migration[6.1] + def up + change_table :case_logs, bulk: true do |t| + t.change :first_time_property_let_as_social_housing, :string + t.change :type_property_most_recently_let_as, :string + t.change :builtype, :string + t.change :do_you_know_the_local_authority, :string + t.change :do_you_know_the_postcode, :string + end + end + + def down + change_table :case_logs, bulk: true do |t| + t.change :first_time_property_let_as_social_housing, :int + t.change :type_property_most_recently_let_as, :int + t.change :builtype, :int + t.change :do_you_know_the_local_authority, :int + t.change :do_you_know_the_postcode, :int + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9b4b2a4bd..5ae2fff35 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_104835) do +ActiveRecord::Schema.define(version: 2021_11_19_154133) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -128,7 +128,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.string "property_owner_organisation" t.string "property_manager_organisation" t.string "sale_or_letting" - t.string "tenant_same_property_renewal" + t.string "renewal" t.string "rent_type" t.string "intermediate_rent_product_name" t.string "needs_type" @@ -154,12 +154,12 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.integer "do_you_know_the_postcode" - t.integer "do_you_know_the_local_authority" + t.string "do_you_know_the_postcode" + t.string "do_you_know_the_local_authority" t.string "why_dont_you_know_la" - t.integer "first_time_property_let_as_social_housing" - t.integer "type_property_most_recently_let_as" - t.integer "builtype" + t.string "first_time_property_let_as_social_housing" + t.string "type_property_most_recently_let_as" + t.string "builtype" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end From 5c3bc1db2c3acba268e6503225017cc3bb62d7b3 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 16:19:53 +0000 Subject: [PATCH 09/22] add fields to completecaselog --- spec/fixtures/complete_case_log.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index fe8393178..2091ba6da 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -57,7 +57,7 @@ "la": "Barnet", "property_postcode": "NW1 5TY", "property_relet": "No", - "rsnvac": "Relet - tenant abandoned property", + "rsnvac": "Renewal of fixed-term tenancy", "property_reference": "P9876", "unittype_gn": "House", "property_building_type": "dummy", @@ -134,6 +134,17 @@ "postcode": "a1", "postcod2": "w3", "ppostc1": "w3", - "ppostc2": "w3" + "ppostc2": "w3", + "do_you_know_the_postcode": "No", + "do_you_know_the_local_authority": "No", + "why_dont_you_know_la": "Forgot", + "first_time_property_let_as_social_housing": "Yes", + "type_property_most_recently_let_as": "", + "property_number_of_times_relet_social_let": "1", + "builtype": "", + "property_wheelchair_accessible": "Yes", + "property_number_of_bedrooms": 2, + "void_or_renewal_date": "05/05/2020", + "new_build_handover_date": "01/01/2019" } } From b85a2a333287362ffc01f3d9bff0c6f8b6443b79 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 16:22:46 +0000 Subject: [PATCH 10/22] change rsnvac enums to correct --- app/constants/db_enums.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb index 7a1c01b19..e0cc05497 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -186,17 +186,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 wdto 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 From b1c3cae3be44cca56cf1811669dd7397e1584efc Mon Sep 17 00:00:00 2001 From: magicmilo Date: Fri, 19 Nov 2021 16:33:39 +0000 Subject: [PATCH 11/22] put rsnvac as array of possibilities dependson --- app/constants/db_enums.rb | 2 +- config/forms/2021_2022.json | 3 +-- spec/fixtures/complete_case_log.json | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb index e0cc05497..c94d8f77c 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -192,7 +192,7 @@ module DbEnums "Tenant moved to other social housing provider" => 12, "Tenant abandoned property" => 6, "Tenant moved to private sector or other accommodation" => 8, - "Relet wdto tenant who occupied same property as temporary accommodation" => 9, + "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, diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index e12961300..578b9d1bc 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1736,8 +1736,7 @@ }, "depends_on": { "renewal": "No", - "rsnvac": "First let of conversion, rehabilitation or acquired property?", - "rsnvac": "First let of leased property" + "rsnvac": ["First let of conversion, rehabilitation or acquired property?", "First let of leased property"] } } } diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 2091ba6da..5b0b03c65 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -57,13 +57,13 @@ "la": "Barnet", "property_postcode": "NW1 5TY", "property_relet": "No", - "rsnvac": "Renewal of fixed-term tenancy", + "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, @@ -139,11 +139,10 @@ "do_you_know_the_local_authority": "No", "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", - "type_property_most_recently_let_as": "", + "type_property_most_recently_let_as": "Affordable rent basis", "property_number_of_times_relet_social_let": "1", - "builtype": "", + "builtype": "Purpose built", "property_wheelchair_accessible": "Yes", - "property_number_of_bedrooms": 2, "void_or_renewal_date": "05/05/2020", "new_build_handover_date": "01/01/2019" } From 4362d6cd1d37bb13eef4e1e16089a0edfadb8ed2 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 10:55:00 +0000 Subject: [PATCH 12/22] add missing fields to completelog --- spec/fixtures/complete_case_log.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 5b0b03c65..8274e5bb0 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -1,12 +1,15 @@ { "case_log": { "tenant_code": "T657", + "tenanceother": "", "age1": 35, "sex1": "Female", "ethnic": "White: English/Scottish/Welsh/Northern Irish/British", "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, @@ -135,8 +138,8 @@ "postcod2": "w3", "ppostc1": "w3", "ppostc2": "w3", - "do_you_know_the_postcode": "No", - "do_you_know_the_local_authority": "No", + "do_you_know_the_postcode": "Yes", + "do_you_know_the_local_authority": "Yes", "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", "type_property_most_recently_let_as": "Affordable rent basis", @@ -144,6 +147,7 @@ "builtype": "Purpose built", "property_wheelchair_accessible": "Yes", "void_or_renewal_date": "05/05/2020", + "renewal": "Yes", "new_build_handover_date": "01/01/2019" } } From 4eed52dc0d58f955f7e908bce4daf6e5c7655923 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 11:05:51 +0000 Subject: [PATCH 13/22] put migrations into one file --- ...20211119104835_add_property_info_fields.rb | 11 +++++----- db/migrate/20211119142809_change_renewal.rb | 7 ------- .../20211119154133_change_column_types.rb | 21 ------------------- db/schema.rb | 2 +- 4 files changed, 7 insertions(+), 34 deletions(-) delete mode 100644 db/migrate/20211119142809_change_renewal.rb delete mode 100644 db/migrate/20211119154133_change_column_types.rb diff --git a/db/migrate/20211119104835_add_property_info_fields.rb b/db/migrate/20211119104835_add_property_info_fields.rb index 78362fe2a..98d8b4b71 100644 --- a/db/migrate/20211119104835_add_property_info_fields.rb +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -1,12 +1,13 @@ class AddPropertyInfoFields < ActiveRecord::Migration[6.1] def change change_table :case_logs, bulk: true do |t| - t.column :do_you_know_the_postcode, :integer - t.column :do_you_know_the_local_authority, :integer + t.column :do_you_know_the_postcode, :string + t.column :do_you_know_the_local_authority, :string t.column :why_dont_you_know_la, :string - t.column :first_time_property_let_as_social_housing, :integer - t.column :type_property_most_recently_let_as, :integer - t.column :builtype, :integer + t.column :first_time_property_let_as_social_housing, :string + t.column :type_property_most_recently_let_as, :string + t.column :builtype, :string + t.rename :tenant_same_property_renewal, :renewal end end end diff --git a/db/migrate/20211119142809_change_renewal.rb b/db/migrate/20211119142809_change_renewal.rb deleted file mode 100644 index f8c244600..000000000 --- a/db/migrate/20211119142809_change_renewal.rb +++ /dev/null @@ -1,7 +0,0 @@ -class ChangeRenewal < ActiveRecord::Migration[6.1] - def change - rename_column :case_logs, :tenant_same_property_renewal, :renewal - end -end - - diff --git a/db/migrate/20211119154133_change_column_types.rb b/db/migrate/20211119154133_change_column_types.rb deleted file mode 100644 index 75c1c05b8..000000000 --- a/db/migrate/20211119154133_change_column_types.rb +++ /dev/null @@ -1,21 +0,0 @@ -class ChangeColumnTypes < ActiveRecord::Migration[6.1] - def up - change_table :case_logs, bulk: true do |t| - t.change :first_time_property_let_as_social_housing, :string - t.change :type_property_most_recently_let_as, :string - t.change :builtype, :string - t.change :do_you_know_the_local_authority, :string - t.change :do_you_know_the_postcode, :string - end - end - - def down - change_table :case_logs, bulk: true do |t| - t.change :first_time_property_let_as_social_housing, :int - t.change :type_property_most_recently_let_as, :int - t.change :builtype, :int - t.change :do_you_know_the_local_authority, :int - t.change :do_you_know_the_postcode, :int - end - end -end diff --git a/db/schema.rb b/db/schema.rb index 5ae2fff35..d96ec5fe2 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_154133) do +ActiveRecord::Schema.define(version: 2021_11_19_104835) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" From e6d59173b4702dc32795d9dfe0e06428c8ba6016 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 12:10:20 +0000 Subject: [PATCH 14/22] add enums and switch to ints --- app/models/case_log.rb | 3 +++ config/forms/2021_2022.json | 12 ++++++------ .../20211119104835_add_property_info_fields.rb | 6 +++--- db/schema.rb | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 32bc40739..fa1c189f9 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -110,6 +110,9 @@ 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 do_you_know_the_postcode: DbEnums.polar, _suffix: true + enum do_you_know_the_local_authority: DbEnums.polar, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 578b9d1bc..b0897a69a 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1124,8 +1124,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" }, "conditional_for": { "postcode": ["Yes"] @@ -1149,8 +1149,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" } } } @@ -1506,8 +1506,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" } } }, diff --git a/db/migrate/20211119104835_add_property_info_fields.rb b/db/migrate/20211119104835_add_property_info_fields.rb index 98d8b4b71..1cab3c7e1 100644 --- a/db/migrate/20211119104835_add_property_info_fields.rb +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -1,10 +1,10 @@ class AddPropertyInfoFields < ActiveRecord::Migration[6.1] def change change_table :case_logs, bulk: true do |t| - t.column :do_you_know_the_postcode, :string - t.column :do_you_know_the_local_authority, :string + t.column :do_you_know_the_postcode, :int + t.column :do_you_know_the_local_authority, :int + t.column :first_time_property_let_as_social_housing, :int t.column :why_dont_you_know_la, :string - t.column :first_time_property_let_as_social_housing, :string t.column :type_property_most_recently_let_as, :string t.column :builtype, :string t.rename :tenant_same_property_renewal, :renewal diff --git a/db/schema.rb b/db/schema.rb index d96ec5fe2..ecf56dd31 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -154,10 +154,10 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.string "do_you_know_the_postcode" - t.string "do_you_know_the_local_authority" + t.integer "do_you_know_the_postcode" + t.integer "do_you_know_the_local_authority" + t.integer "first_time_property_let_as_social_housing" t.string "why_dont_you_know_la" - t.string "first_time_property_let_as_social_housing" t.string "type_property_most_recently_let_as" t.string "builtype" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" From d6c4027dd2afb22e17121b55018ce8846633b72e Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 13:34:17 +0000 Subject: [PATCH 15/22] add optional fields --- app/models/case_log.rb | 5 ++--- spec/fixtures/complete_case_log.json | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index fa1c189f9..13290daa5 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -111,10 +111,9 @@ class CaseLog < ApplicationRecord 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 do_you_know_the_postcode: DbEnums.polar, _suffix: true - enum do_you_know_the_local_authority: DbEnums.polar, _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 @@ -224,7 +223,7 @@ private end def mandatory_fields - required = attributes.except(*AUTOGENERATED_FIELDS) + required = attributes.except(*(AUTOGENERATED_FIELDS + OPTIONAL_FIELDS)) dynamically_not_required = [] diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 8274e5bb0..2345097dc 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -138,8 +138,6 @@ "postcod2": "w3", "ppostc1": "w3", "ppostc2": "w3", - "do_you_know_the_postcode": "Yes", - "do_you_know_the_local_authority": "Yes", "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", "type_property_most_recently_let_as": "Affordable rent basis", From a43710db3d3d8d034a9dcbdbbd634745deec2ced Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 13:35:31 +0000 Subject: [PATCH 16/22] rubocop --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index dcb8a18b3..cd22b2eb7 100644 --- a/Gemfile +++ b/Gemfile @@ -33,8 +33,8 @@ gem "chartkick" gem "roo" # Json Schema gem "json-schema" -gem "uk_postcode" gem "turbo-rails", "~> 0.8" +gem "uk_postcode" group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console From 83df9292eac85b21f0b595f667b4a9ef4fe0166f Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 13:37:52 +0000 Subject: [PATCH 17/22] change type --- db/migrate/20211119104835_add_property_info_fields.rb | 2 -- db/schema.rb | 2 -- spec/fixtures/complete_case_log.json | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/db/migrate/20211119104835_add_property_info_fields.rb b/db/migrate/20211119104835_add_property_info_fields.rb index 1cab3c7e1..e50eaba38 100644 --- a/db/migrate/20211119104835_add_property_info_fields.rb +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -1,8 +1,6 @@ class AddPropertyInfoFields < ActiveRecord::Migration[6.1] def change change_table :case_logs, bulk: true do |t| - t.column :do_you_know_the_postcode, :int - t.column :do_you_know_the_local_authority, :int 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 diff --git a/db/schema.rb b/db/schema.rb index ecf56dd31..0221a6b6f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -154,8 +154,6 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.integer "do_you_know_the_postcode" - t.integer "do_you_know_the_local_authority" t.integer "first_time_property_let_as_social_housing" t.string "why_dont_you_know_la" t.string "type_property_most_recently_let_as" diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 2345097dc..36d34c9fc 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -141,7 +141,7 @@ "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", "type_property_most_recently_let_as": "Affordable rent basis", - "property_number_of_times_relet_social_let": "1", + "property_number_of_times_relet_social_let": 1, "builtype": "Purpose built", "property_wheelchair_accessible": "Yes", "void_or_renewal_date": "05/05/2020", From 903726eda6a13bc6c90cd40c39093ba5727e2fd0 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 14:12:31 +0000 Subject: [PATCH 18/22] switch renewal field --- config/forms/2021_2022.json | 24 +-- ...20211119104835_add_property_info_fields.rb | 1 - db/schema.rb | 6 +- spec/factories/case_log.rb | 2 +- spec/fixtures/complete_case_log.json | 3 +- spec/fixtures/forms/test_aboutthislog.json | 179 ------------------ 6 files changed, 17 insertions(+), 198 deletions(-) delete mode 100644 spec/fixtures/forms/test_aboutthislog.json diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 4bc590c18..aabab9c24 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -81,14 +81,14 @@ "header": "About this log", "description": "Is this a renewal to the same tenant in the same property?", "questions": { - "renewal": { + "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" + "0": "No", + "1": "Yes" } } }, @@ -1516,7 +1516,7 @@ } } }, - "depends_on": { "renewal": "No"} + "depends_on": { "tenant_same_property_renewal": "No"} }, "type_property_most_recently_let_as": { "header": "", @@ -1535,7 +1535,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" } }, "property_vacancy_reason_not_first_let": { "header": "", @@ -1561,7 +1561,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" } }, "property_vacancy_reason_first_let": { "header": "", @@ -1579,7 +1579,7 @@ } } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "tenant_same_property_renewal": "No" } }, "property_number_of_times_relet_not_social_let": { "header": "", @@ -1595,7 +1595,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "No", "tenant_same_property_renewal": "No" } }, "property_number_of_times_relet_social_let": { "header": "", @@ -1611,7 +1611,7 @@ "step": 1 } }, - "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" } + "depends_on": { "first_time_property_let_as_social_housing": "Yes", "tenant_same_property_renewal": "No" } }, "property_unit_type": { "header": "", @@ -1694,7 +1694,7 @@ "type": "date" } }, - "depends_on": { "rsnvac": "First let of newbuild property", "renewal": "No" } + "depends_on": { "rsnvac": "First let of newbuild property", "tenant_same_property_renewal": "No" } }, "property_major_repairs": { "header": "", @@ -1712,7 +1712,7 @@ "conditional_for": { "mrcdate": ["Yes"] }, - "depends_on": { "renewal": "No" } + "depends_on": { "tenant_same_property_renewal": "No" } }, "mrcdate": { "check_answer_label": "What was the major repairs completion date?", @@ -1740,7 +1740,7 @@ "mrcdate": ["Yes"] }, "depends_on": { - "renewal": "No", + "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 index e50eaba38..c4f900a91 100644 --- a/db/migrate/20211119104835_add_property_info_fields.rb +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -5,7 +5,6 @@ class AddPropertyInfoFields < ActiveRecord::Migration[6.1] t.column :why_dont_you_know_la, :string t.column :type_property_most_recently_let_as, :string t.column :builtype, :string - t.rename :tenant_same_property_renewal, :renewal end end end diff --git a/db/schema.rb b/db/schema.rb index d4d1ce8e6..a5a0b5194 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -137,7 +137,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do t.string "property_owner_organisation" t.string "property_manager_organisation" t.string "sale_or_letting" - t.string "renewal" + t.string "tenant_same_property_renewal" t.string "rent_type" t.string "intermediate_rent_product_name" t.string "needs_type" @@ -163,12 +163,12 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do t.integer "incref" 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.string "type_property_most_recently_let_as" t.string "builtype" - t.integer "armedforces" - t.string "property_postcode" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index 6adc93555..e7f0259cd 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 36d34c9fc..b5204c7f2 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -127,7 +127,6 @@ "property_owner_organisation": "", "property_manager_organisation": "", "sale_or_letting": "", - "tenant_same_property_renewal": "", "rent_type": "", "intermediate_rent_product_name": "", "needs_type": "", @@ -145,7 +144,7 @@ "builtype": "Purpose built", "property_wheelchair_accessible": "Yes", "void_or_renewal_date": "05/05/2020", - "renewal": "Yes", + "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" } - } - } - } - } - } - } -} From cdb9f94a2c41002c2e4793419878f302b1799b19 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 14:21:42 +0000 Subject: [PATCH 19/22] remove unused test form so fix validate test --- spec/lib/tasks/form_definition_validator_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a923e14969f415e0db4f408b0e4ce7854fc42303 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 15:36:38 +0000 Subject: [PATCH 20/22] change field to correct unitletas --- app/admin/case_logs.rb | 2 +- app/constants/db_enums.rb | 9 +++++++++ app/models/case_log.rb | 1 + config/forms/2021_2022.json | 2 +- ...211124152204_change_recently_let_as_to_enum.rb | 15 +++++++++++++++ db/schema.rb | 4 ++-- spec/fixtures/complete_case_log.json | 4 +--- 7 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20211124152204_change_recently_let_as_to_enum.rb 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 c94d8f77c..341d13155 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -10,6 +10,15 @@ 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.ecstat { "Part-time - Less than 30 hours" => 2, diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 4f9ded977..ae165cb75 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -111,6 +111,7 @@ class CaseLog < ApplicationRecord 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 diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index aabab9c24..2ad460b3b 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1518,7 +1518,7 @@ }, "depends_on": { "tenant_same_property_renewal": "No"} }, - "type_property_most_recently_let_as": { + "unitletas": { "header": "", "description": "", "questions": { 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..9758b400c --- /dev/null +++ b/db/migrate/20211124152204_change_recently_let_as_to_enum.rb @@ -0,0 +1,15 @@ +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 + end + end + + def down + change_table :case_logs, bulk: true do |t| + t.remove :unitletas + t.column :type_property_most_recently_let_as, :string + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a5a0b5194..ebc40c05b 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" @@ -167,8 +167,8 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do t.string "property_postcode" t.integer "first_time_property_let_as_social_housing" t.string "why_dont_you_know_la" - t.string "type_property_most_recently_let_as" t.string "builtype" + t.integer "unitletas" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index b5204c7f2..a1bcea38b 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -1,7 +1,6 @@ { "case_log": { "tenant_code": "T657", - "tenanceother": "", "age1": 35, "sex1": "Female", "ethnic": "White: English/Scottish/Welsh/Northern Irish/British", @@ -139,8 +138,7 @@ "ppostc2": "w3", "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", - "type_property_most_recently_let_as": "Affordable rent basis", - "property_number_of_times_relet_social_let": 1, + "unitletas": "Affordable rent basis", "builtype": "Purpose built", "property_wheelchair_accessible": "Yes", "void_or_renewal_date": "05/05/2020", From 3b3b57021df454d34f28e02b4afa0f51325cee62 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 15:39:34 +0000 Subject: [PATCH 21/22] switch yesnofields to match polar enum --- config/forms/2021_2022.json | 8 ++++---- docs/api/DLUHC-CORE-Data.v1.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 2ad460b3b..737acb070 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1706,8 +1706,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" }, "conditional_for": { "mrcdate": ["Yes"] @@ -1733,8 +1733,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yesx" }, "conditional_for": { "mrcdate": ["Yes"] 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, From ee976eea4480c95c794d9cf74198b0f744c65d6a Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 15:50:56 +0000 Subject: [PATCH 22/22] change unitletas --- app/constants/db_enums.rb | 7 +++++++ config/forms/2021_2022.json | 2 +- .../20211124152204_change_recently_let_as_to_enum.rb | 4 ++++ db/schema.rb | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb index 341d13155..4cd0a82e7 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -19,6 +19,13 @@ module DbEnums } end + def self.builtype + { + "Purpose built" => 1, + "Conversion" => 2 + } + end + def self.ecstat { "Part-time - Less than 30 hours" => 2, diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 737acb070..0b62cef59 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1522,7 +1522,7 @@ "header": "", "description": "", "questions": { - "type_property_most_recently_let_as": { + "unitletas": { "check_answer_label": "Type property most recently let as", "header": "Which type was the property most recently let as?", "hint_text": "", diff --git a/db/migrate/20211124152204_change_recently_let_as_to_enum.rb b/db/migrate/20211124152204_change_recently_let_as_to_enum.rb index 9758b400c..d5cddce59 100644 --- a/db/migrate/20211124152204_change_recently_let_as_to_enum.rb +++ b/db/migrate/20211124152204_change_recently_let_as_to_enum.rb @@ -3,6 +3,8 @@ class ChangeRecentlyLetAsToEnum < ActiveRecord::Migration[6.1] 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 @@ -10,6 +12,8 @@ class ChangeRecentlyLetAsToEnum < ActiveRecord::Migration[6.1] 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 ebc40c05b..0c8b93e67 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -167,8 +167,8 @@ ActiveRecord::Schema.define(version: 2021_11_24_152204) do t.string "property_postcode" t.integer "first_time_property_let_as_social_housing" t.string "why_dont_you_know_la" - t.string "builtype" t.integer "unitletas" + t.integer "builtype" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end