Browse Source

Merge pull request #95 from communitiesuk/CLDC-687ImplementPropertyInformation

CLDC-687 implement property information
pull/108/head
Milo 3 years ago committed by GitHub
parent
commit
0448a584cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Gemfile.lock
  2. 2
      app/admin/case_logs.rb
  3. 38
      app/constants/db_enums.rb
  4. 5
      app/models/case_log.rb
  5. 281
      config/forms/2021_2022.json
  6. 10
      db/migrate/20211119104835_add_property_info_fields.rb
  7. 19
      db/migrate/20211124152204_change_recently_let_as_to_enum.rb
  8. 8
      db/schema.rb
  9. 2
      docs/api/DLUHC-CORE-Data.v1.json
  10. 2
      spec/factories/case_log.rb
  11. 17
      spec/fixtures/complete_case_log.json
  12. 179
      spec/fixtures/forms/test_aboutthislog.json
  13. 2
      spec/lib/tasks/form_definition_validator_spec.rb

2
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)

2
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

38
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

5
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 = []

281
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"]
}
}
}

10
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

19
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

8
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,10 @@ ActiveRecord::Schema.define(version: 2021_11_19_120910) do
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

2
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,

2
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 }

17
spec/fixtures/complete_case_log.json vendored

@ -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"
}
}

179
spec/fixtures/forms/test_aboutthislog.json vendored

@ -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" }
}
}
}
}
}
}
}

2
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

Loading…
Cancel
Save