magicmilo
3 years ago
51 changed files with 2879 additions and 1124 deletions
@ -0,0 +1,703 @@
|
||||
module DbEnums |
||||
def self.benefitcap |
||||
{ |
||||
"Yes - benefit cap" => 5, |
||||
"Yes - removal of the spare room subsidy" => 4, |
||||
"Yes - both the benefit cap and the removal of the spare room subsidy" => 6, |
||||
"No" => 2, |
||||
"Do not know" => 3, |
||||
"Prefer not to say" => 100, |
||||
} |
||||
end |
||||
|
||||
def self.ecstat |
||||
{ |
||||
"Part-time - Less than 30 hours" => 2, |
||||
"Full-time - 30 hours or more" => 1, |
||||
"In government training into work, such as New Deal" => 3, |
||||
"Jobseeker" => 4, |
||||
"Retired" => 5, |
||||
"Not seeking work" => 6, |
||||
"Full-time student" => 7, |
||||
"Unable to work because of long term sick or disability" => 8, |
||||
"Child under 16" => 9, |
||||
"Other" => 0, |
||||
"Prefer not to say" => 10, |
||||
} |
||||
end |
||||
|
||||
def self.ethnic |
||||
{ |
||||
"White: English/Scottish/Welsh/Northern Irish/British" => 1, |
||||
"White: Irish" => 2, |
||||
"White: Gypsy/Irish Traveller" => 18, |
||||
"White: Other" => 3, |
||||
"Mixed: White & Black Caribbean" => 4, |
||||
"Mixed: White & Black African" => 5, |
||||
"Mixed: White & Asian" => 6, |
||||
"Mixed: Other" => 7, |
||||
"Asian or Asian British: Indian" => 8, |
||||
"Asian or Asian British: Pakistani" => 9, |
||||
"Asian or Asian British: Bangladeshi" => 10, |
||||
"Asian or Asian British: Chinese" => 15, |
||||
"Asian or Asian British: Other" => 11, |
||||
"Black: Caribbean" => 12, |
||||
"Black: African" => 13, |
||||
"Black: Other" => 14, |
||||
"Other Ethnic Group: Arab" => 16, |
||||
"Other Ethnic Group: Other" => 19, |
||||
"Prefer not to say" => 17, |
||||
} |
||||
end |
||||
|
||||
def self.homeless |
||||
{ |
||||
"Yes - assessed as homeless by a local authority and owed a homelessness duty. Including if threatened with homelessness within 56 days" => 11, |
||||
"Yes - other homelessness" => 7, |
||||
"No" => 1, |
||||
} |
||||
end |
||||
|
||||
def self.illness |
||||
{ |
||||
"Yes" => 1, |
||||
"No" => 2, |
||||
"Do not know" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.leftreg |
||||
{ |
||||
"Yes" => 6, |
||||
"No - they left up to 5 years ago" => 4, |
||||
"No - they left more than 5 years ago" => 5, |
||||
"Prefer not to say" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.national |
||||
{ |
||||
"UK national resident in UK" => 1, |
||||
"A current or former reserve in the UK Armed Forces (exc. National Service)" => 100, |
||||
"UK national returning from residence overseas" => 2, |
||||
"Czech Republic" => 3, |
||||
"Estonia" => 4, |
||||
"Hungary" => 5, |
||||
"Latvia" => 6, |
||||
"Lithuania" => 7, |
||||
"Poland" => 8, |
||||
"Slovakia" => 9, |
||||
"Bulgaria" => 14, |
||||
"Romania" => 15, |
||||
"Ireland" => 17, |
||||
"Slovenia" => 10, |
||||
"Croatia" => 16, |
||||
"Other EU Economic Area (EEA country)" => 11, |
||||
"Any other country" => 12, |
||||
"Prefer not to say" => 13, |
||||
} |
||||
end |
||||
|
||||
def self.pregnancy |
||||
{ |
||||
"Yes" => 1, |
||||
"No" => 2, |
||||
"Prefer not to say" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.previous_tenancy |
||||
{ |
||||
"Owner occupation (private) " => 26, |
||||
"Owner occupation (low cost home ownership)" => 27, |
||||
"Private sector tenancy" => 3, |
||||
"Tied housing or rented with job" => 4, |
||||
"Supported housing" => 5, |
||||
"Sheltered accomodation" => 8, |
||||
"Residential care home" => 9, |
||||
"Living with friends or family" => 28, |
||||
"Refuge" => 21, |
||||
"Hospital" => 10, |
||||
"Prison / approved probation hostel" => 29, |
||||
"Direct access hostel" => 7, |
||||
"Bed & Breakfast" => 14, |
||||
"Mobile home / caravan" => 23, |
||||
"Any other temporary accommodation" => 18, |
||||
"Home Office Asylum Support" => 24, |
||||
"Children’s home / foster care" => 13, |
||||
"Rough sleeping" => 19, |
||||
"Other" => 25, |
||||
"Fixed term Local Authority General Needs tenancy" => 30, |
||||
"Lifetime Local Authority General Needs tenancy" => 31, |
||||
"Fixed term PRP General Needs tenancy" => 32, |
||||
"Lifetime PRP General Needs tenancy" => 33, |
||||
} |
||||
end |
||||
|
||||
def self.reservist |
||||
{ |
||||
"Yes" => 1, |
||||
"No" => 2, |
||||
"Prefer not to say" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.polar |
||||
{ |
||||
"No" => 0, |
||||
"Yes" => 1, |
||||
} |
||||
end |
||||
|
||||
def self.polar2 |
||||
{ |
||||
"No" => 2, |
||||
"Yes" => 1, |
||||
} |
||||
end |
||||
|
||||
def self.polar_with_unknown |
||||
{ |
||||
"No" => 2, |
||||
"Yes" => 1, |
||||
"Do not know" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.tenancy |
||||
{ |
||||
"Fixed term – Secure" => 1, |
||||
"Fixed term – Assured Shorthold Tenancy (AST)" => 4, |
||||
"Lifetime – Secure" => 100, |
||||
"Lifetime – Assured" => 2, |
||||
"License agreement" => 5, |
||||
"Other" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.landlord |
||||
{ |
||||
"This landlord" => 1, |
||||
"Another registered provider - includes housing association or local authority" => 2, |
||||
} |
||||
end |
||||
|
||||
def self.rsnvac |
||||
{ |
||||
"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, |
||||
} |
||||
end |
||||
|
||||
def self.unittype_gn |
||||
{ |
||||
"Flat / maisonette" => 1, |
||||
"Bed-sit" => 2, |
||||
"House" => 7, |
||||
"Bungalow" => 8, |
||||
"Shared flat / maisonette" => 4, |
||||
"Shared house" => 9, |
||||
"Shared bungalow" => 10, |
||||
"Other" => 6, |
||||
} |
||||
end |
||||
|
||||
def self.incfreq |
||||
{ |
||||
"Weekly" => 1, |
||||
"Monthly" => 2, |
||||
"Yearly" => 3, |
||||
} |
||||
end |
||||
|
||||
def self.override_soft_validation |
||||
{ |
||||
"No" => 0, |
||||
"Yes" => 1, |
||||
} |
||||
end |
||||
|
||||
def self.benefits |
||||
{ |
||||
"All" => 1, |
||||
"Some" => 2, |
||||
"None" => 3, |
||||
"Do not know" => 4, |
||||
} |
||||
end |
||||
|
||||
def self.period |
||||
{ |
||||
"Weekly for 52 weeks" => 1, |
||||
"Fortnightly" => 2, |
||||
"Four-weekly" => 3, |
||||
"Calendar monthly" => 4, |
||||
"Weekly for 50 weeks" => 5, |
||||
"Weekly for 49 weeks" => 6, |
||||
"Weekly for 48 weeks" => 7, |
||||
"Weekly for 47 weeks" => 8, |
||||
"Weekly for 46 weeks" => 9, |
||||
"Weekly for 53 weeks" => 10, |
||||
} |
||||
end |
||||
|
||||
def self.latime |
||||
{ |
||||
"Just moved to local authority area" => 1, |
||||
"Less than 1 year" => 2, |
||||
"1 to 2 years" => 7, |
||||
"2 to 3 years" => 8, |
||||
"3 to 4 years" => 9, |
||||
"4 to 5 years" => 10, |
||||
"5 years or more" => 5, |
||||
"Do not know" => 6, |
||||
} |
||||
end |
||||
|
||||
def self.housing_benefit |
||||
{ |
||||
"Housing Benefit, but not Universal Credit" => 1, |
||||
"Universal Credit with housing element, but not Housing Benefit" => 6, |
||||
"Universal Credit without housing element and no Housing Benefit" => 7, |
||||
"Universal Credit and Housing Benefit" => 8, |
||||
"Not Housing Benefit or Universal Credit" => 9, |
||||
"Do not know" => 3, |
||||
"Prefer not to say" => 100, |
||||
} |
||||
end |
||||
|
||||
def self.reason |
||||
{ |
||||
"Permanently decanted from another property owned by this landlord" => 1, |
||||
"Left home country as a refugee" => 2, |
||||
"Loss of tied accommodation" => 4, |
||||
"Domestic abuse" => 7, |
||||
"(Non violent) relationship breakdown with partner" => 8, |
||||
"Asked to leave by family or friends" => 9, |
||||
"Racial harassment" => 10, |
||||
"Other problems with neighbours" => 11, |
||||
"Property unsuitable because of overcrowding" => 12, |
||||
"End of assured shorthold tenancy - no fault" => 40, |
||||
"End of assured shorthold tenancy - tenant's fault" => 41, |
||||
"End of fixed term tenancy - no fault" => 42, |
||||
"End of fixed term tenancy - tenant's fault" => 43, |
||||
"Repossession" => 34, |
||||
"Under occupation - offered incentive to downsize" => 29, |
||||
"Under occupation - no incentive" => 30, |
||||
"Property unsuitable because of ill health / disability" => 13, |
||||
"Property unsuitable because of poor condition" => 14, |
||||
"Couldn't afford fees attached to renewing the tenancy" => 35, |
||||
"Couldn't afford increase in rent" => 36, |
||||
"Couldn't afford rent or mortgage - welfare reforms" => 37, |
||||
"Couldn't afford rent or mortgage - employment" => 38, |
||||
"Couldn't afford rent or mortgage - other" => 39, |
||||
"To move nearer to family / friends / school" => 16, |
||||
"To move nearer to work" => 17, |
||||
"To move to accomodation with support" => 18, |
||||
"To move to independent accomodation" => 19, |
||||
"Hate crime" => 31, |
||||
"Death of household member in last settled accomodation" => 46, |
||||
"Discharged from prison" => 44, |
||||
"Discharged from long stay hospital or similar institution" => 45, |
||||
"Other" => 20, |
||||
"Do not know" => 28, |
||||
"Prefer not to say" => 100, |
||||
} |
||||
end |
||||
|
||||
def self.la |
||||
{ |
||||
"Hartlepool" => "E06000001", |
||||
"Na h-Eileanan Siar" => "S12000013", |
||||
"Middlesbrough" => "E06000002", |
||||
"Redcar and Cleveland" => "E06000003", |
||||
"Stockton-on-Tees" => "E06000004", |
||||
"Darlington" => "E06000005", |
||||
"Halton" => "E06000006", |
||||
"Warrington" => "E06000007", |
||||
"Blackburn with Darwen" => "E06000008", |
||||
"Blackpool" => "E06000009", |
||||
"Kingston upon Hull, City of" => "E06000010", |
||||
"East Riding of Yorkshire" => "E06000011", |
||||
"North East Lincolnshire" => "E06000012", |
||||
"North Lincolnshire" => "E06000013", |
||||
"York" => "E06000014", |
||||
"Derby" => "E06000015", |
||||
"Leicester" => "E06000016", |
||||
"Rutland" => "E06000017", |
||||
"Nottingham" => "E06000018", |
||||
"Herefordshire, County of" => "E06000019", |
||||
"Telford and Wrekin" => "E06000020", |
||||
"Stoke-on-Trent" => "E06000021", |
||||
"Bath and North East Somerset" => "E06000022", |
||||
"Bristol, City of" => "E06000023", |
||||
"North Somerset" => "E06000024", |
||||
"South Gloucestershire" => "E06000025", |
||||
"Plymouth" => "E06000026", |
||||
"Torbay" => "E06000027", |
||||
"Swindon" => "E06000030", |
||||
"Peterborough" => "E06000031", |
||||
"Luton" => "E06000032", |
||||
"Southend-on-Sea" => "E06000033", |
||||
"Thurrock" => "E06000034", |
||||
"Medway" => "E06000035", |
||||
"Bracknell Forest" => "E06000036", |
||||
"West Berkshire" => "E06000037", |
||||
"Reading" => "E06000038", |
||||
"Slough" => "E06000039", |
||||
"Windsor and Maidenhead" => "E06000040", |
||||
"Wokingham" => "E06000041", |
||||
"Milton Keynes" => "E06000042", |
||||
"Brighton and Hove" => "E06000043", |
||||
"Portsmouth" => "E06000044", |
||||
"Southampton" => "E06000045", |
||||
"Isle of Wight" => "E06000046", |
||||
"County Durham" => "E06000047", |
||||
"Cheshire East" => "E06000049", |
||||
"Cheshire West and Chester" => "E06000050", |
||||
"Shropshire" => "E06000051", |
||||
"Cornwall" => "E06000052", |
||||
"Isles of Scilly" => "E06000053", |
||||
"Wiltshire" => "E06000054", |
||||
"Bedford" => "E06000055", |
||||
"Central Bedfordshire" => "E06000056", |
||||
"Northumberland" => "E06000057", |
||||
"Bournemouth, Christchurch and Poole" => "E06000058", |
||||
"North Warwickshire" => "E07000218", |
||||
"Nuneaton and Bedworth" => "E07000219", |
||||
"Rugby" => "E07000220", |
||||
"Stratford-on-Avon" => "E07000221", |
||||
"Warwick" => "E07000222", |
||||
"Adur" => "E07000223", |
||||
"Arun" => "E07000224", |
||||
"Chichester" => "E07000225", |
||||
"Crawley" => "E07000226", |
||||
"Horsham" => "E07000227", |
||||
"Mid Sussex" => "E07000228", |
||||
"Worthing" => "E07000229", |
||||
"Bromsgrove" => "E07000234", |
||||
"Malvern Hills" => "E07000235", |
||||
"Redditch" => "E07000236", |
||||
"Worcester" => "E07000237", |
||||
"Wychavon" => "E07000238", |
||||
"Wyre Forest" => "E07000239", |
||||
"St Albans" => "E07000240", |
||||
"Welwyn Hatfield" => "E07000241", |
||||
"East Hertfordshire" => "E07000242", |
||||
"Stevenage" => "E07000243", |
||||
"East Suffolk" => "E07000244", |
||||
"West Suffolk" => "E07000245", |
||||
"Somerset West and Taunton" => "E07000246", |
||||
"Bolton" => "E08000001", |
||||
"Bury" => "E08000002", |
||||
"Manchester" => "E08000003", |
||||
"Oldham" => "E08000004", |
||||
"Rochdale" => "E08000005", |
||||
"Salford" => "E08000006", |
||||
"Stockport" => "E08000007", |
||||
"Tameside" => "E08000008", |
||||
"Trafford" => "E08000009", |
||||
"Wigan" => "E08000010", |
||||
"Knowsley" => "E08000011", |
||||
"Liverpool" => "E08000012", |
||||
"St. Helens" => "E08000013", |
||||
"Sefton" => "E08000014", |
||||
"Wirral" => "E08000015", |
||||
"Barnsley" => "E08000016", |
||||
"Doncaster" => "E08000017", |
||||
"Rotherham" => "E08000018", |
||||
"Sheffield" => "E08000019", |
||||
"Newcastle upon Tyne" => "E08000021", |
||||
"North Tyneside" => "E08000022", |
||||
"South Tyneside" => "E08000023", |
||||
"Sunderland" => "E08000024", |
||||
"Birmingham" => "E08000025", |
||||
"Coventry" => "E08000026", |
||||
"Dudley" => "E08000027", |
||||
"Sandwell" => "E08000028", |
||||
"Solihull" => "E08000029", |
||||
"Walsall" => "E08000030", |
||||
"Dorset" => "E06000059", |
||||
"Wolverhampton" => "E08000031", |
||||
"Falkirk" => "S12000014", |
||||
"Highland" => "S12000017", |
||||
"Inverclyde" => "S12000018", |
||||
"Midlothian" => "S12000019", |
||||
"Moray" => "S12000020", |
||||
"North Ayrshire" => "S12000021", |
||||
"Orkney Islands" => "S12000023", |
||||
"Scottish Borders" => "S12000026", |
||||
"Shetland Islands" => "S12000027", |
||||
"South Ayrshire" => "S12000028", |
||||
"South Lanarkshire" => "S12000029", |
||||
"Stirling" => "S12000030", |
||||
"Aberdeen City" => "S12000033", |
||||
"Aberdeenshire" => "S12000034", |
||||
"Argyll and Bute" => "S12000035", |
||||
"City of Edinburgh" => "S12000036", |
||||
"Renfrewshire" => "S12000038", |
||||
"West Dunbartonshire" => "S12000039", |
||||
"West Lothian" => "S12000040", |
||||
"Angus" => "S12000041", |
||||
"Dundee City" => "S12000042", |
||||
"East Dunbartonshire" => "S12000045", |
||||
"Buckinghamshire" => "E06000060", |
||||
"Fife" => "S12000047", |
||||
"Cambridge" => "E07000008", |
||||
"Perth and Kinross" => "S12000048", |
||||
"East Cambridgeshire" => "E07000009", |
||||
"Glasgow City" => "S12000049", |
||||
"Fenland" => "E07000010", |
||||
"North Lanarkshire" => "S12000050", |
||||
"Huntingdonshire" => "E07000011", |
||||
"Isle of Anglesey" => "W06000001", |
||||
"South Cambridgeshire" => "E07000012", |
||||
"Gwynedd" => "W06000002", |
||||
"Allerdale" => "E07000026", |
||||
"Conwy" => "W06000003", |
||||
"Barrow-in-Furness" => "E07000027", |
||||
"Denbighshire" => "W06000004", |
||||
"Carlisle" => "E07000028", |
||||
"Flintshire" => "W06000005", |
||||
"Copeland" => "E07000029", |
||||
"Wrexham" => "W06000006", |
||||
"Eden" => "E07000030", |
||||
"Ceredigion" => "W06000008", |
||||
"South Lakeland" => "E07000031", |
||||
"Pembrokeshire" => "W06000009", |
||||
"Amber Valley" => "E07000032", |
||||
"Carmarthenshire" => "W06000010", |
||||
"Bolsover" => "E07000033", |
||||
"Swansea" => "W06000011", |
||||
"Chesterfield" => "E07000034", |
||||
"Neath Port Talbot" => "W06000012", |
||||
"Derbyshire Dales" => "E07000035", |
||||
"Bridgend" => "W06000013", |
||||
"Erewash" => "E07000036", |
||||
"Vale of Glamorgan" => "W06000014", |
||||
"High Peak" => "E07000037", |
||||
"Cardiff" => "W06000015", |
||||
"North East Derbyshire" => "E07000038", |
||||
"Rhondda Cynon Taf" => "W06000016", |
||||
"South Derbyshire" => "E07000039", |
||||
"Caerphilly" => "W06000018", |
||||
"East Devon" => "E07000040", |
||||
"Blaenau Gwent" => "W06000019", |
||||
"Exeter" => "E07000041", |
||||
"Torfaen" => "W06000020", |
||||
"Mid Devon" => "E07000042", |
||||
"Monmouthshire" => "W06000021", |
||||
"North Devon" => "E07000043", |
||||
"Newport" => "W06000022", |
||||
"South Hams" => "E07000044", |
||||
"Powys" => "W06000023", |
||||
"Teignbridge" => "E07000045", |
||||
"Merthyr Tydfil" => "W06000024", |
||||
"Torridge" => "E07000046", |
||||
"West Devon" => "E07000047", |
||||
"Eastbourne" => "E07000061", |
||||
"Hastings" => "E07000062", |
||||
"Lewes" => "E07000063", |
||||
"Rother" => "E07000064", |
||||
"Wealden" => "E07000065", |
||||
"Basildon" => "E07000066", |
||||
"Braintree" => "E07000067", |
||||
"Brentwood" => "E07000068", |
||||
"Castle Point" => "E07000069", |
||||
"Chelmsford" => "E07000070", |
||||
"Colchester" => "E07000071", |
||||
"Epping Forest" => "E07000072", |
||||
"Harlow" => "E07000073", |
||||
"Maldon" => "E07000074", |
||||
"Rochford" => "E07000075", |
||||
"Tendring" => "E07000076", |
||||
"Uttlesford" => "E07000077", |
||||
"Cheltenham" => "E07000078", |
||||
"Cotswold" => "E07000079", |
||||
"Forest of Dean" => "E07000080", |
||||
"Gloucester" => "E07000081", |
||||
"Stroud" => "E07000082", |
||||
"Tewkesbury" => "E07000083", |
||||
"Basingstoke and Deane" => "E07000084", |
||||
"East Hampshire" => "E07000085", |
||||
"King’s Lynn and West Norfolk" => "E07000146", |
||||
"Eastleigh" => "E07000086", |
||||
"North Norfolk" => "E07000147", |
||||
"Norwich" => "E07000148", |
||||
"South Norfolk" => "E07000149", |
||||
"Corby" => "E07000150", |
||||
"Daventry" => "E07000151", |
||||
"East Northamptonshire" => "E07000152", |
||||
"Kettering" => "E07000153", |
||||
"Northampton" => "E07000154", |
||||
"South Northamptonshire" => "E07000155", |
||||
"Wellingborough" => "E07000156", |
||||
"Craven" => "E07000163", |
||||
"Hambleton" => "E07000164", |
||||
"Harrogate" => "E07000165", |
||||
"Richmondshire" => "E07000166", |
||||
"Ryedale" => "E07000167", |
||||
"Scarborough" => "E07000168", |
||||
"Selby" => "E07000169", |
||||
"Ashfield" => "E07000170", |
||||
"Bassetlaw" => "E07000171", |
||||
"Broxtowe" => "E07000172", |
||||
"Gedling" => "E07000173", |
||||
"Mansfield" => "E07000174", |
||||
"Newark and Sherwood" => "E07000175", |
||||
"Rushcliffe" => "E07000176", |
||||
"Cherwell" => "E07000177", |
||||
"Oxford" => "E07000178", |
||||
"South Oxfordshire" => "E07000179", |
||||
"Vale of White Horse" => "E07000180", |
||||
"West Oxfordshire" => "E07000181", |
||||
"Mendip" => "E07000187", |
||||
"Sedgemoor" => "E07000188", |
||||
"South Somerset" => "E07000189", |
||||
"Cannock Chase" => "E07000192", |
||||
"East Staffordshire" => "E07000193", |
||||
"Lichfield" => "E07000194", |
||||
"Newcastle-under-Lyme" => "E07000195", |
||||
"South Staffordshire" => "E07000196", |
||||
"Stafford" => "E07000197", |
||||
"Staffordshire Moorlands" => "E07000198", |
||||
"Tamworth" => "E07000199", |
||||
"Babergh" => "E07000200", |
||||
"Ipswich" => "E07000202", |
||||
"Mid Suffolk" => "E07000203", |
||||
"Elmbridge" => "E07000207", |
||||
"Epsom and Ewell" => "E07000208", |
||||
"Guildford" => "E07000209", |
||||
"Mole Valley" => "E07000210", |
||||
"Reigate and Banstead" => "E07000211", |
||||
"Runnymede" => "E07000212", |
||||
"Spelthorne" => "E07000213", |
||||
"Surrey Heath" => "E07000214", |
||||
"Tandridge" => "E07000215", |
||||
"Waverley" => "E07000216", |
||||
"Woking" => "E07000217", |
||||
"Fareham" => "E07000087", |
||||
"Gosport" => "E07000088", |
||||
"Hart" => "E07000089", |
||||
"Havant" => "E07000090", |
||||
"New Forest" => "E07000091", |
||||
"Rushmoor" => "E07000092", |
||||
"Test Valley" => "E07000093", |
||||
"Winchester" => "E07000094", |
||||
"Broxbourne" => "E07000095", |
||||
"Dacorum" => "E07000096", |
||||
"Hertsmere" => "E07000098", |
||||
"North Hertfordshire" => "E07000099", |
||||
"Three Rivers" => "E07000102", |
||||
"Watford" => "E07000103", |
||||
"Ashford" => "E07000105", |
||||
"Canterbury" => "E07000106", |
||||
"Dartford" => "E07000107", |
||||
"Dover" => "E07000108", |
||||
"Gravesham" => "E07000109", |
||||
"Maidstone" => "E07000110", |
||||
"Sevenoaks" => "E07000111", |
||||
"Folkestone and Hythe" => "E07000112", |
||||
"Swale" => "E07000113", |
||||
"Thanet" => "E07000114", |
||||
"Tonbridge and Malling" => "E07000115", |
||||
"Tunbridge Wells" => "E07000116", |
||||
"Burnley" => "E07000117", |
||||
"Chorley" => "E07000118", |
||||
"Fylde" => "E07000119", |
||||
"Hyndburn" => "E07000120", |
||||
"Lancaster" => "E07000121", |
||||
"Pendle" => "E07000122", |
||||
"Preston" => "E07000123", |
||||
"Ribble Valley" => "E07000124", |
||||
"Rossendale" => "E07000125", |
||||
"South Ribble" => "E07000126", |
||||
"West Lancashire" => "E07000127", |
||||
"Wyre" => "E07000128", |
||||
"Blaby" => "E07000129", |
||||
"Charnwood" => "E07000130", |
||||
"Harborough" => "E07000131", |
||||
"Hinckley and Bosworth" => "E07000132", |
||||
"Melton" => "E07000133", |
||||
"North West Leicestershire" => "E07000134", |
||||
"Oadby and Wigston" => "E07000135", |
||||
"Boston" => "E07000136", |
||||
"East Lindsey" => "E07000137", |
||||
"Lincoln" => "E07000138", |
||||
"North Kesteven" => "E07000139", |
||||
"South Holland" => "E07000140", |
||||
"South Kesteven" => "E07000141", |
||||
"West Lindsey" => "E07000142", |
||||
"Breckland" => "E07000143", |
||||
"Broadland" => "E07000144", |
||||
"Great Yarmouth" => "E07000145", |
||||
"Bradford" => "E08000032", |
||||
"Calderdale" => "E08000033", |
||||
"Kirklees" => "E08000034", |
||||
"Leeds" => "E08000035", |
||||
"Wakefield" => "E08000036", |
||||
"Gateshead" => "E08000037", |
||||
"City of London" => "E09000001", |
||||
"Barking and Dagenham" => "E09000002", |
||||
"Barnet" => "E09000003", |
||||
"Bexley" => "E09000004", |
||||
"Brent" => "E09000005", |
||||
"Bromley" => "E09000006", |
||||
"Camden" => "E09000007", |
||||
"Croydon" => "E09000008", |
||||
"Ealing" => "E09000009", |
||||
"Enfield" => "E09000010", |
||||
"Greenwich" => "E09000011", |
||||
"Hackney" => "E09000012", |
||||
"Hammersmith and Fulham" => "E09000013", |
||||
"Haringey" => "E09000014", |
||||
"Harrow" => "E09000015", |
||||
"Havering" => "E09000016", |
||||
"Hillingdon" => "E09000017", |
||||
"Hounslow" => "E09000018", |
||||
"Islington" => "E09000019", |
||||
"Kensington and Chelsea" => "E09000020", |
||||
"Kingston upon Thames" => "E09000021", |
||||
"Lambeth" => "E09000022", |
||||
"Lewisham" => "E09000023", |
||||
"Merton" => "E09000024", |
||||
"Newham" => "E09000025", |
||||
"Redbridge" => "E09000026", |
||||
"Richmond upon Thames" => "E09000027", |
||||
"Southwark" => "E09000028", |
||||
"Sutton" => "E09000029", |
||||
"Tower Hamlets" => "E09000030", |
||||
"Waltham Forest" => "E09000031", |
||||
"Wandsworth" => "E09000032", |
||||
"Westminster" => "E09000033", |
||||
"Antrim and Newtownabbey" => "N09000001", |
||||
"Armagh City, Banbridge and Craigavon" => "N09000002", |
||||
"Belfast" => "N09000003", |
||||
"Causeway Coast and Glens" => "N09000004", |
||||
"Derry City and Strabane" => "N09000005", |
||||
"Fermanagh and Omagh" => "N09000006", |
||||
"Lisburn and Castlereagh" => "N09000007", |
||||
"Mid and East Antrim" => "N09000008", |
||||
"Mid Ulster" => "N09000009", |
||||
"Newry, Mourne and Down" => "N09000010", |
||||
"Ards and North Down" => "N09000011", |
||||
"Clackmannanshire" => "S12000005", |
||||
"Dumfries and Galloway" => "S12000006", |
||||
"East Ayrshire" => "S12000008", |
||||
"East Lothian" => "S12000010", |
||||
"East Renfrewshire" => "S12000011", |
||||
} |
||||
end |
||||
end |
@ -0,0 +1,20 @@
|
||||
class SoftValidationsController < ApplicationController |
||||
def show |
||||
@case_log = CaseLog.find(params[:case_log_id]) |
||||
page_key = request.env["PATH_INFO"].split("/")[-2] |
||||
form = FormHandler.instance.get_form("2021_2022") |
||||
page = form.all_pages[page_key] |
||||
if page_requires_soft_validation_override?(page) |
||||
errors = @case_log.soft_errors.values.first |
||||
render json: { show: true, label: errors.message, hint: errors.hint_text } |
||||
else |
||||
render json: { show: false } |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
def page_requires_soft_validation_override?(page) |
||||
@case_log.soft_errors.present? && @case_log.soft_errors.keys.first == page["soft_validations"]&.keys&.first |
||||
end |
||||
end |
@ -0,0 +1,36 @@
|
||||
import { Controller } from "@hotwired/stimulus" |
||||
|
||||
export default class extends Controller { |
||||
static targets = [ "override" ] |
||||
|
||||
initialize() { |
||||
let url = window.location.href + "/soft_validations" |
||||
this.fetch_retry(url, { headers: { accept: "application/json" } }, 2) |
||||
} |
||||
|
||||
fetch_retry(url, options, n) { |
||||
let self = this |
||||
let div = this.overrideTarget |
||||
fetch(url, options) |
||||
.then(response => response.json()) |
||||
.then((response) => { |
||||
if(response["show"]){ |
||||
div.style.display = "block" |
||||
let innerHTML = div.innerHTML |
||||
innerHTML = innerHTML.replace("soft-validations-placeholder-message", response["label"]) |
||||
innerHTML = innerHTML.replace("soft-validations-placeholder-hint-text", response["hint"]) |
||||
div.innerHTML = innerHTML |
||||
} else { |
||||
div.style.display = "none" |
||||
let buttons = document.getElementsByName(`case_log[override_net_income_validation][]`) |
||||
Object.entries(buttons).map(([idx, button]) => { |
||||
button.checked = false |
||||
}) |
||||
} |
||||
}) |
||||
.catch(function(error) { |
||||
if (n === 1) throw error |
||||
return self.fetch_retry(url, options, n - 1) |
||||
}) |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
|
||||
<%= answers = question["answer_options"].map {|key, value| OpenStruct.new(id:key, name: value)} |
||||
f.govuk_collection_select question_key, |
||||
answers, |
||||
:name, |
||||
:name, |
||||
label: { text: question["header"]}, |
||||
hint: { text: question["hint_text"] } |
||||
%> |
||||
|
||||
|
@ -1,11 +1,15 @@
|
||||
<div class="govuk-form-group govuk-form-group--error"> |
||||
<%= f.govuk_check_boxes_fieldset @case_log.soft_errors.keys.first, |
||||
legend: { text: @case_log.soft_errors.values.first.message, size: "l" }, |
||||
hint: { text: @case_log.soft_errors.values.first.hint_text } do %> |
||||
<div class="govuk-form-group govuk-form-group--error" |
||||
data-controller="soft-validations" |
||||
data-soft-validations-target="override" |
||||
style='display:none;'> |
||||
|
||||
<%= f.govuk_check_box @case_log.soft_errors.keys.first, @case_log.soft_errors.keys.first, |
||||
<%= f.govuk_check_boxes_fieldset page_info["soft_validations"]&.keys&.first, |
||||
legend: { text: "soft-validations-placeholder-message", size: "l" }, |
||||
hint: { text: "soft-validations-placeholder-hint-text" } do %> |
||||
|
||||
<%= f.govuk_check_box page_info["soft_validations"]&.keys&.first, page_info["soft_validations"]&.keys&.first, |
||||
label: { text: "Yes" }, |
||||
checked: f.object.send(@case_log.soft_errors.keys.first) |
||||
checked: @case_log[page_info["soft_validations"]&.keys&.first] == "Yes" |
||||
%> |
||||
<% end %> |
||||
</div> |
||||
|
@ -0,0 +1,106 @@
|
||||
class RenameFields < ActiveRecord::Migration[6.1] |
||||
def change |
||||
rename_column :case_logs, :person_1_age, :age1 |
||||
rename_column :case_logs, :person_1_gender, :sex1 |
||||
rename_column :case_logs, :tenant_ethnic_group, :ethnic |
||||
rename_column :case_logs, :tenant_nationality, :national |
||||
rename_column :case_logs, :person_1_economic_status, :ecstat1 |
||||
rename_column :case_logs, :household_number_of_other_members, :hhmemb |
||||
|
||||
rename_column :case_logs, :person_2_relationship, :relat2 |
||||
rename_column :case_logs, :person_2_age, :age2 |
||||
rename_column :case_logs, :person_2_gender, :sex2 |
||||
rename_column :case_logs, :person_2_economic_status, :ecstat2 |
||||
|
||||
rename_column :case_logs, :person_3_relationship, :relat3 |
||||
rename_column :case_logs, :person_3_age, :age3 |
||||
rename_column :case_logs, :person_3_gender, :sex3 |
||||
rename_column :case_logs, :person_3_economic_status, :ecstat3 |
||||
|
||||
rename_column :case_logs, :person_4_relationship, :relat4 |
||||
rename_column :case_logs, :person_4_age, :age4 |
||||
rename_column :case_logs, :person_4_gender, :sex4 |
||||
rename_column :case_logs, :person_4_economic_status, :ecstat4 |
||||
|
||||
rename_column :case_logs, :person_5_relationship, :relat5 |
||||
rename_column :case_logs, :person_5_age, :age5 |
||||
rename_column :case_logs, :person_5_gender, :sex5 |
||||
rename_column :case_logs, :person_5_economic_status, :ecstat5 |
||||
|
||||
rename_column :case_logs, :person_6_relationship, :relat6 |
||||
rename_column :case_logs, :person_6_age, :age6 |
||||
rename_column :case_logs, :person_6_gender, :sex6 |
||||
rename_column :case_logs, :person_6_economic_status, :ecstat6 |
||||
|
||||
rename_column :case_logs, :person_7_relationship, :relat7 |
||||
rename_column :case_logs, :person_7_age, :age7 |
||||
rename_column :case_logs, :person_7_gender, :sex7 |
||||
rename_column :case_logs, :person_7_economic_status, :ecstat7 |
||||
|
||||
rename_column :case_logs, :person_8_relationship, :relat8 |
||||
rename_column :case_logs, :person_8_age, :age8 |
||||
rename_column :case_logs, :person_8_gender, :sex8 |
||||
rename_column :case_logs, :person_8_economic_status, :ecstat8 |
||||
|
||||
rename_column :case_logs, :previous_housing_situation, :prevten |
||||
rename_column :case_logs, :homelessness, :homeless |
||||
rename_column :case_logs, :benefit_cap_spare_room_subsidy, :underoccupation_benefitcap |
||||
rename_column :case_logs, :armed_forces_injured, :reservist |
||||
rename_column :case_logs, :armed_forces_active, :leftreg |
||||
rename_column :case_logs, :medical_conditions, :illness |
||||
rename_column :case_logs, :pregnancy, :preg_occ |
||||
|
||||
rename_column :case_logs, :accessibility_requirements_fully_wheelchair_accessible_housing, :housingneeds_a |
||||
rename_column :case_logs, :accessibility_requirements_wheelchair_access_to_essential_rooms, :housingneeds_b |
||||
rename_column :case_logs, :accessibility_requirements_level_access_housing, :housingneeds_c |
||||
rename_column :case_logs, :accessibility_requirements_other_disability_requirements, :housingneeds_f |
||||
rename_column :case_logs, :accessibility_requirements_no_disability_requirements, :housingneeds_g |
||||
rename_column :case_logs, :accessibility_requirements_do_not_know, :housingneeds_h |
||||
|
||||
rename_column :case_logs, :condition_effects_vision, :illness_type_1 |
||||
rename_column :case_logs, :condition_effects_hearing, :illness_type_2 |
||||
rename_column :case_logs, :condition_effects_mobility, :illness_type_3 |
||||
rename_column :case_logs, :condition_effects_dexterity, :illness_type_4 |
||||
rename_column :case_logs, :condition_effects_stamina, :illness_type_8 |
||||
rename_column :case_logs, :condition_effects_learning, :illness_type_5 |
||||
rename_column :case_logs, :condition_effects_memory, :illness_type_6 |
||||
rename_column :case_logs, :condition_effects_mental_health, :illness_type_7 |
||||
rename_column :case_logs, :condition_effects_social_or_behavioral, :illness_type_9 |
||||
rename_column :case_logs, :condition_effects_other, :illness_type_10 |
||||
|
||||
rename_column :case_logs, :tenancy_start_date, :startdate |
||||
rename_column :case_logs, :starter_tenancy, :startertenancy |
||||
rename_column :case_logs, :fixed_term_tenancy, :tenancylength |
||||
rename_column :case_logs, :tenancy_type, :tenancy |
||||
rename_column :case_logs, :other_tenancy_type, :tenancyother |
||||
rename_column :case_logs, :letting_type, :lettype |
||||
rename_column :case_logs, :letting_provider, :landlord |
||||
rename_column :case_logs, :property_vacancy_reason, :rsnvac |
||||
rename_column :case_logs, :property_unit_type, :unittype_gn |
||||
rename_column :case_logs, :property_number_of_bedrooms, :beds |
||||
rename_column :case_logs, :property_number_of_times_relet, :offered |
||||
rename_column :case_logs, :property_wheelchair_accessible, :wchair |
||||
rename_column :case_logs, :net_income, :earnings |
||||
rename_column :case_logs, :net_income_frequency, :incfreq |
||||
rename_column :case_logs, :net_income_uc_proportion, :benefits |
||||
rename_column :case_logs, :rent_frequency, :period |
||||
rename_column :case_logs, :basic_rent, :brent |
||||
rename_column :case_logs, :service_charge, :scharge |
||||
rename_column :case_logs, :personal_service_charge, :pscharge |
||||
rename_column :case_logs, :support_charge, :supcharg |
||||
rename_column :case_logs, :total_charge, :tcharge |
||||
rename_column :case_logs, :time_lived_in_la, :layear |
||||
rename_column :case_logs, :time_on_la_waiting_list, :lawaitlist |
||||
rename_column :case_logs, :reasonable_preference, :reasonpref |
||||
|
||||
rename_column :case_logs, :reasonable_preference_reason_homeless, :rp_homeless |
||||
rename_column :case_logs, :reasonable_preference_reason_unsatisfactory_housing, :rp_insan_unsat |
||||
rename_column :case_logs, :reasonable_preference_reason_medical_grounds, :rp_medwel |
||||
rename_column :case_logs, :reasonable_preference_reason_avoid_hardship, :rp_hardship |
||||
rename_column :case_logs, :reasonable_preference_reason_do_not_know, :rp_dontknow |
||||
|
||||
rename_column :case_logs, :cbl_letting, :cbl |
||||
rename_column :case_logs, :chr_letting, :chr |
||||
rename_column :case_logs, :cap_letting, :cap |
||||
end |
||||
end |
@ -0,0 +1,17 @@
|
||||
class AddAboutThisLogReadableColumns < ActiveRecord::Migration[6.1] |
||||
def change |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :gdpr_acceptance, :string |
||||
t.column :gdpr_declined, :string |
||||
t.column :property_owner_organisation, :string |
||||
t.column :property_manager_organisation, :string |
||||
t.column :sale_or_letting, :string |
||||
t.column :tenant_same_property_renewal, :string |
||||
t.column :rent_type, :string |
||||
t.column :intermediate_rent_product_name, :string |
||||
t.column :needs_type, :string |
||||
t.column :sale_completion_date, :string |
||||
t.column :purchaser_code, :string |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,131 @@
|
||||
class ChangeFieldTypes < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :ethnic, "integer USING ethnic::integer" |
||||
t.change :national, "integer USING national::integer" |
||||
t.change :ecstat1, "integer USING ecstat1::integer" |
||||
t.change :ecstat2, "integer USING ecstat2::integer" |
||||
t.change :ecstat3, "integer USING ecstat3::integer" |
||||
t.change :ecstat4, "integer USING ecstat4::integer" |
||||
t.change :ecstat5, "integer USING ecstat5::integer" |
||||
t.change :ecstat6, "integer USING ecstat6::integer" |
||||
t.change :ecstat7, "integer USING ecstat7::integer" |
||||
t.change :ecstat8, "integer USING ecstat8::integer" |
||||
t.change :prevten, "integer USING prevten::integer" |
||||
t.change :homeless, "integer USING homeless::integer" |
||||
t.change :underoccupation_benefitcap, "integer USING underoccupation_benefitcap::integer" |
||||
t.change :reservist, "integer USING reservist::integer" |
||||
t.change :leftreg, "integer USING leftreg::integer" |
||||
t.change :illness, "integer USING illness::integer" |
||||
t.change :preg_occ, "integer USING preg_occ::integer" |
||||
t.change :housingneeds_a, "integer USING housingneeds_a::integer" |
||||
t.change :housingneeds_b, "integer USING housingneeds_b::integer" |
||||
t.change :housingneeds_c, "integer USING housingneeds_c::integer" |
||||
t.change :housingneeds_f, "integer USING housingneeds_f::integer" |
||||
t.change :housingneeds_g, "integer USING housingneeds_g::integer" |
||||
t.change :housingneeds_h, "integer USING housingneeds_h::integer" |
||||
t.change :illness_type_1, "integer USING illness_type_1::integer" |
||||
t.change :illness_type_2, "integer USING illness_type_2::integer" |
||||
t.change :illness_type_3, "integer USING illness_type_3::integer" |
||||
t.change :illness_type_4, "integer USING illness_type_4::integer" |
||||
t.change :illness_type_5, "integer USING illness_type_5::integer" |
||||
t.change :illness_type_6, "integer USING illness_type_6::integer" |
||||
t.change :illness_type_7, "integer USING illness_type_7::integer" |
||||
t.change :illness_type_8, "integer USING illness_type_8::integer" |
||||
t.change :illness_type_9, "integer USING illness_type_9::integer" |
||||
t.change :illness_type_10, "integer USING illness_type_10::integer" |
||||
t.change :rp_homeless, "integer USING rp_homeless::integer" |
||||
t.change :rp_insan_unsat, "integer USING rp_insan_unsat::integer" |
||||
t.change :rp_medwel, "integer USING rp_medwel::integer" |
||||
t.change :rp_hardship, "integer USING rp_hardship::integer" |
||||
t.change :rp_dontknow, "integer USING rp_dontknow::integer" |
||||
t.change :cbl, "integer USING cbl::integer" |
||||
t.change :chr, "integer USING chr::integer" |
||||
t.change :cap, "integer USING cap::integer" |
||||
t.change :startertenancy, "integer USING startertenancy::integer" |
||||
t.change :tenancylength, "integer USING tenancylength::integer" |
||||
t.change :tenancy, "integer USING tenancy::integer" |
||||
t.change :landlord, "integer USING landlord::integer" |
||||
t.change :rsnvac, "integer USING rsnvac::integer" |
||||
t.change :unittype_gn, "integer USING unittype_gn::integer" |
||||
t.change :beds, "integer USING beds::integer" |
||||
t.change :wchair, "integer USING wchair::integer" |
||||
t.change :incfreq, "integer USING incfreq::integer" |
||||
t.change :benefits, "integer USING benefits::integer" |
||||
t.change :period, "integer USING period::integer" |
||||
t.change :brent, "integer USING brent::integer" |
||||
t.change :scharge, "integer USING scharge::integer" |
||||
t.change :pscharge, "integer USING pscharge::integer" |
||||
t.change :supcharg, "integer USING supcharg::integer" |
||||
t.change :tcharge, "integer USING tcharge::integer" |
||||
t.change :layear, "integer USING layear::integer" |
||||
t.change :lawaitlist, "integer USING lawaitlist::integer" |
||||
t.change :reasonpref, "integer USING reasonpref::integer" |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :ethnic, :string |
||||
t.change :national, :string |
||||
t.change :ecstat1, :string |
||||
t.change :ecstat2, :string |
||||
t.change :ecstat3, :string |
||||
t.change :ecstat4, :string |
||||
t.change :ecstat5, :string |
||||
t.change :ecstat6, :string |
||||
t.change :ecstat7, :string |
||||
t.change :ecstat8, :string |
||||
t.change :prevten, :string |
||||
t.change :homeless, :string |
||||
t.change :underoccupation_benefitcap, :string |
||||
t.change :reservist, :string |
||||
t.change :leftreg, :string |
||||
t.change :illness, :string |
||||
t.change :preg_occ, :string |
||||
t.change :housingneeds_a, "boolean USING housingneeds_a::boolean" |
||||
t.change :housingneeds_b, "boolean USING housingneeds_b::boolean" |
||||
t.change :housingneeds_c, "boolean USING housingneeds_c::boolean" |
||||
t.change :housingneeds_f, "boolean USING housingneeds_f::boolean" |
||||
t.change :housingneeds_g, "boolean USING housingneeds_g::boolean" |
||||
t.change :housingneeds_h, "boolean USING housingneeds_h::boolean" |
||||
t.change :illness_type_1, "boolean USING illness_type_1::boolean" |
||||
t.change :illness_type_2, "boolean USING illness_type_2::boolean" |
||||
t.change :illness_type_3, "boolean USING illness_type_3::boolean" |
||||
t.change :illness_type_4, "boolean USING illness_type_4::boolean" |
||||
t.change :illness_type_5, "boolean USING illness_type_5::boolean" |
||||
t.change :illness_type_6, "boolean USING illness_type_6::boolean" |
||||
t.change :illness_type_7, "boolean USING illness_type_7::boolean" |
||||
t.change :illness_type_8, "boolean USING illness_type_8::boolean" |
||||
t.change :illness_type_9, "boolean USING illness_type_9::boolean" |
||||
t.change :illness_type_10, "boolean USING illness_type_10::boolean" |
||||
t.change :rp_homeless, :boolean |
||||
t.change :rp_insan_unsat, :boolean |
||||
t.change :rp_medwel, :boolean |
||||
t.change :rp_hardship, :boolean |
||||
t.change :rp_dontknow, :boolean |
||||
t.change :cbl_letting, :string |
||||
t.change :chr_letting, :string |
||||
t.change :cap_letting, :string |
||||
t.change :startertenancy, :string |
||||
t.change :tenancylength, :string |
||||
t.change :tenancy, :string |
||||
t.change :landlord, :string |
||||
t.change :rsnvac, :string |
||||
t.change :unittype_gn, :string |
||||
t.change :beds, :string |
||||
t.change :wchair, :string |
||||
t.change :incfreq, :string |
||||
t.change :benefits, :string |
||||
t.change :period, :string |
||||
t.change :brent, :string |
||||
t.change :scharge, :string |
||||
t.change :pscharge, :string |
||||
t.change :supcharg, :string |
||||
t.change :tcharge, :string |
||||
t.change :layear, :string |
||||
t.change :lawaitlist, :string |
||||
t.change :reasonpref, :string |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,9 @@
|
||||
class ChangeNetIncomeOveride < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_column :case_logs, :override_net_income_validation, "integer USING CAST(override_net_income_validation AS integer)" |
||||
end |
||||
|
||||
def down |
||||
change_column :case_logs, :override_net_income_validation, "boolean USING override_net_income_validation::boolean" |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class ChangeCheckboxTypes < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :accessibility_requirements_prefer_not_to_say, "integer USING accessibility_requirements_prefer_not_to_say::integer" |
||||
t.change :condition_effects_prefer_not_to_say, "integer USING condition_effects_prefer_not_to_say::integer" |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.change :accessibility_requirements_prefer_not_to_say, "boolean USING accessibility_requirements_prefer_not_to_say::boolean" |
||||
t.change :condition_effects_prefer_not_to_say, "boolean USING condition_effects_prefer_not_to_say::boolean" |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,57 @@
|
||||
class FurtherCoreMigrations < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.remove :condition_effects_prefer_not_to_say |
||||
t.remove :reason_for_leaving_last_settled_home |
||||
t.column :reason, :integer |
||||
t.remove :property_reference |
||||
t.column :propcode, :string |
||||
t.remove :property_major_repairs |
||||
t.column :majorrepairs, :integer |
||||
t.remove :property_location |
||||
t.column :la, :string |
||||
t.remove :previous_la |
||||
t.column :prevloc, :string |
||||
t.remove :housing_benefit |
||||
t.column :hb, :integer |
||||
t.remove :outstanding_rent_or_charges |
||||
t.column :hbrentshortfall, :integer |
||||
t.remove :outstanding_amount |
||||
t.column :tshortfall, :integer |
||||
t.column :postcode, :string |
||||
t.column :postcod2, :string |
||||
t.column :ppostc1, :string |
||||
t.column :ppostc2, :string |
||||
t.remove :property_relet |
||||
t.column :property_relet, :integer |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :condition_effects_prefer_not_to_say, :integer |
||||
t.column :reason_for_leaving_last_settled_home, :string |
||||
t.remove :reason |
||||
t.column :property_reference, :string |
||||
t.remove :propcode |
||||
t.column :property_major_repairs, :string |
||||
t.remove :majorrepairs |
||||
t.column :property_location, :string |
||||
t.remove :la |
||||
t.column :previous_la, :string |
||||
t.remove :prevloc |
||||
t.column :housing_benefit, :string |
||||
t.remove :hb |
||||
t.column :outstanding_rent_or_charges, :string |
||||
t.remove :hbrentshortfall |
||||
t.column :outstanding_amount, :string |
||||
t.remove :tshortfall |
||||
t.remove :postcode |
||||
t.remove :postcod2 |
||||
t.remove :ppostc1 |
||||
t.remove :ppostc2 |
||||
t.remove :property_relet |
||||
t.column :property_relet, :string |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,21 @@
|
||||
class AddMrcDates < ActiveRecord::Migration[6.1] |
||||
def up |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.remove :property_major_repairs_date |
||||
t.column :mrcdate, :datetime |
||||
t.column :mrcday, :integer |
||||
t.column :mrcmonth, :integer |
||||
t.column :mrcyear, :integer |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :property_major_repairs_date, :string |
||||
t.remove :mrcdate |
||||
t.remove :mrcday |
||||
t.remove :mrcmonth |
||||
t.remove :mrcyear |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddOtherMembersColumn < ActiveRecord::Migration[6.1] |
||||
def change |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :other_hhmemb, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,8 @@
|
||||
class AddIncrefField < ActiveRecord::Migration[6.1] |
||||
def change |
||||
change_table :case_logs, bulk: true do |t| |
||||
t.column :incref, :integer |
||||
end |
||||
end |
||||
end |
||||
|
@ -0,0 +1,11 @@
|
||||
### ADR - 008: Field Names |
||||
|
||||
We are changing the schema to reflect the way the data is stored in CORE. |
||||
This is due to the SPSS queries that are being performed by ADD and the complexity that would come with changing them. |
||||
|
||||
The field names are saved lowercase as opposed to the uppercase versions we see in CORE. |
||||
This is due to Ruby expecting the uppercase parameters to be constants and database fields are expected to be lower case. |
||||
These fields could be mapped to their uppercase versions during the replication if needed. |
||||
|
||||
A lot of the values are now also being stored as enums. |
||||
This gives as some validation by default as the values not defined in the enums will fail to save. |
File diff suppressed because it is too large
Load Diff
@ -1,118 +1,141 @@
|
||||
{ |
||||
"case_log": |
||||
{ |
||||
"tenant_code": "T657", |
||||
"person_1_age": 35, |
||||
"person_1_gender": "Female", |
||||
"tenant_ethnic_group": "White: English/Scottish/Welsh/Northern Irish/British", |
||||
"tenant_nationality": "UK national resident in UK", |
||||
"previous_housing_situation": "Private sector tenancy", |
||||
"armed_forces": "Yes - a regular", |
||||
"person_1_economic_status": "Full-time - 30 hours or more", |
||||
"household_number_of_other_members": 7, |
||||
"person_2_relationship": "Partner", |
||||
"person_2_age": 32, |
||||
"person_2_gender": "Male", |
||||
"person_2_economic_status": "Not seeking work", |
||||
"person_3_relationship": "Child - includes young adult and grown-up", |
||||
"person_3_age": 12, |
||||
"person_3_gender": "Male", |
||||
"person_3_economic_status": "Child under 16", |
||||
"person_4_relationship": "Child - includes young adult and grown-up", |
||||
"person_4_age": 12, |
||||
"person_4_gender": "Female", |
||||
"person_4_economic_status": "Child under 16", |
||||
"person_5_relationship": "Child - includes young adult and grown-up", |
||||
"person_5_age": 10, |
||||
"person_5_gender": "Non-binary", |
||||
"person_5_economic_status": "Child under 16", |
||||
"person_6_relationship": "Child - includes young adult and grown-up", |
||||
"person_6_age": 5, |
||||
"person_6_gender": "Prefer not to say", |
||||
"person_6_economic_status": "Child under 16", |
||||
"person_7_relationship": "Child - includes young adult and grown-up", |
||||
"person_7_age": 5, |
||||
"person_7_gender": "Prefer not to say", |
||||
"person_7_economic_status": "Child under 16", |
||||
"person_8_relationship": "Child - includes young adult and grown-up", |
||||
"person_8_age": 2, |
||||
"person_8_gender": "Prefer not to say", |
||||
"person_8_economic_status": "Child under 16", |
||||
"homelessness": "Yes - other homelessness", |
||||
"reason_for_leaving_last_settled_home": "Other problems with neighbours", |
||||
"benefit_cap_spare_room_subsidy": "No", |
||||
"armed_forces_active": "No", |
||||
"armed_forces_injured": "No", |
||||
"armed_forces_partner": "No", |
||||
"medical_conditions": "Yes", |
||||
"pregnancy": "No", |
||||
"accessibility_requirements": "No", |
||||
"condition_effects": "dummy", |
||||
"tenancy_code": "BZ757", |
||||
"tenancy_start_date": "12/03/2019", |
||||
"starter_tenancy": "No", |
||||
"fixed_term_tenancy": "5", |
||||
"tenancy_type": "Fixed term – Secure", |
||||
"letting_type": "Affordable Rent - General Needs", |
||||
"letting_provider": "This landlord", |
||||
"property_location": "Barnet", |
||||
"previous_postcode": "NW1 5TY", |
||||
"property_relet": "No", |
||||
"property_vacancy_reason": "Relet - tenant abandoned property", |
||||
"property_reference": "P9876", |
||||
"property_unit_type": "House", |
||||
"property_building_type": "dummy", |
||||
"property_number_of_bedrooms": 3, |
||||
"property_void_date": "03/11/2019", |
||||
"property_major_repairs": "Yes", |
||||
"property_major_repairs_date": "05/05/2020", |
||||
"property_number_of_times_relet": 2, |
||||
"property_wheelchair_accessible": true, |
||||
"net_income_known": "Yes", |
||||
"net_income": 0, |
||||
"net_income_frequency": null, |
||||
"net_income_uc_proportion": "Some", |
||||
"housing_benefit": "Universal Credit with housing element, but not Housing Benefit", |
||||
"rent_frequency": "Weekly", |
||||
"basic_rent": 200, |
||||
"service_charge": 50, |
||||
"personal_service_charge": 40, |
||||
"support_charge": 35, |
||||
"total_charge": 325, |
||||
"outstanding_amount": "Yes", |
||||
"time_lived_in_la": "1 to 2 years", |
||||
"time_on_la_waiting_list": "Less than 1 year", |
||||
"previous_la": "Ashford", |
||||
"property_postcode": "SE2 6RT", |
||||
"reasonable_preference": "Yes", |
||||
"reasonable_preference_reason": "dummy", |
||||
"cbl_letting": true, |
||||
"chr_letting": false, |
||||
"cap_letting": false, |
||||
"outstanding_rent_or_charges": 25, |
||||
"other_reason_for_leaving_last_settled_home": null, |
||||
"accessibility_requirements_fully_wheelchair_accessible_housing": true, |
||||
"accessibility_requirements_wheelchair_access_to_essential_rooms": false, |
||||
"accessibility_requirements_level_access_housing": false, |
||||
"accessibility_requirements_other_disability_requirements": false, |
||||
"accessibility_requirements_no_disability_requirements": false, |
||||
"accessibility_requirements_do_not_know": false, |
||||
"accessibility_requirements_prefer_not_to_say": false, |
||||
"condition_effects_vision": false, |
||||
"condition_effects_hearing": true, |
||||
"condition_effects_mobility": false, |
||||
"condition_effects_dexterity": false, |
||||
"condition_effects_stamina": false, |
||||
"condition_effects_learning": false, |
||||
"condition_effects_memory": false, |
||||
"condition_effects_mental_health": false, |
||||
"condition_effects_social_or_behavioral": false, |
||||
"condition_effects_other": false, |
||||
"condition_effects_prefer_not_to_say": true, |
||||
"reasonable_preference_reason_homeless": false, |
||||
"reasonable_preference_reason_unsatisfactory_housing": false, |
||||
"reasonable_preference_reason_medical_grounds": false, |
||||
"reasonable_preference_reason_avoid_hardship": false, |
||||
"reasonable_preference_reason_do_not_know": true |
||||
} |
||||
"case_log": { |
||||
"tenant_code": "T657", |
||||
"age1": 35, |
||||
"sex1": "Female", |
||||
"ethnic": "White: English/Scottish/Welsh/Northern Irish/British", |
||||
"national": "UK national resident in UK", |
||||
"prevten": "Private sector tenancy", |
||||
"armed_forces": "Yes - a regular", |
||||
"ecstat1": "Full-time - 30 hours or more", |
||||
"other_hhmemb": 7, |
||||
"hhmemb": 8, |
||||
"relat2": "Partner", |
||||
"age2": 32, |
||||
"sex2": "Male", |
||||
"ecstat2": "Not seeking work", |
||||
"relat3": "Child - includes young adult and grown-up", |
||||
"age3": 12, |
||||
"sex3": "Male", |
||||
"ecstat3": "Child under 16", |
||||
"relat4": "Child - includes young adult and grown-up", |
||||
"age4": 12, |
||||
"sex4": "Female", |
||||
"ecstat4": "Child under 16", |
||||
"relat5": "Child - includes young adult and grown-up", |
||||
"age5": 10, |
||||
"sex5": "Non-binary", |
||||
"ecstat5": "Child under 16", |
||||
"relat6": "Child - includes young adult and grown-up", |
||||
"age6": 5, |
||||
"sex6": "Prefer not to say", |
||||
"ecstat6": "Child under 16", |
||||
"relat7": "Child - includes young adult and grown-up", |
||||
"age7": 5, |
||||
"sex7": "Prefer not to say", |
||||
"ecstat7": "Child under 16", |
||||
"relat8": "Child - includes young adult and grown-up", |
||||
"age8": 2, |
||||
"sex8": "Prefer not to say", |
||||
"ecstat8": "Child under 16", |
||||
"homeless": "Yes - other homelessness", |
||||
"reason": 1, |
||||
"underoccupation_benefitcap": "No", |
||||
"leftreg": "No - they left up to 5 years ago", |
||||
"reservist": "No", |
||||
"armed_forces_partner": "No", |
||||
"illness": "Yes", |
||||
"preg_occ": "No", |
||||
"accessibility_requirements": "No", |
||||
"condition_effects": "dummy", |
||||
"tenancy_code": "BZ757", |
||||
"startdate": "12/03/2019", |
||||
"startertenancy": "No", |
||||
"tenancylength": "5", |
||||
"tenancy": "Fixed term – Secure", |
||||
"lettype": "Affordable Rent - General Needs", |
||||
"landlord": "This landlord", |
||||
"la": "Barnet", |
||||
"property_postcode": "NW1 5TY", |
||||
"property_relet": "No", |
||||
"rsnvac": "Relet - tenant abandoned property", |
||||
"property_reference": "P9876", |
||||
"unittype_gn": "House", |
||||
"property_building_type": "dummy", |
||||
"beds": 3, |
||||
"property_void_date": "03/11/2019", |
||||
"majorrepairs": "Yes", |
||||
"mrcdate": "05/05/2020", |
||||
"mrcday": 5, |
||||
"mrcmonth": 5, |
||||
"mrcyear": 2020, |
||||
"offered": 2, |
||||
"wchair": "Yes", |
||||
"net_income_known": "Yes", |
||||
"earnings": 0, |
||||
"incfreq": null, |
||||
"benefits": "Some", |
||||
"hb": "Universal Credit with housing element, but not Housing Benefit", |
||||
"period": "Fortnightly", |
||||
"brent": 200, |
||||
"scharge": 50, |
||||
"pscharge": 40, |
||||
"supcharg": 35, |
||||
"tcharge": 325, |
||||
"outstanding_amount": "Yes", |
||||
"layear": "1 to 2 years", |
||||
"lawaitlist": "Less than 1 year", |
||||
"prevloc": "Ashford", |
||||
"previous_postcode": "SE2 6RT", |
||||
"reasonpref": "Yes", |
||||
"reasonable_preference_reason": "dummy", |
||||
"cbl": "Yes", |
||||
"chr": "Yes", |
||||
"cap": "No", |
||||
"hbrentshortfall": "Yes", |
||||
"tshortfall": 12, |
||||
"other_reason_for_leaving_last_settled_home": null, |
||||
"housingneeds_a": "Yes", |
||||
"housingneeds_b": "No", |
||||
"housingneeds_c": "No", |
||||
"housingneeds_f": "No", |
||||
"housingneeds_g": "No", |
||||
"housingneeds_h": "No", |
||||
"accessibility_requirements_prefer_not_to_say": "No", |
||||
"illness_type_1": "No", |
||||
"illness_type_2": "Yes", |
||||
"illness_type_3": "No", |
||||
"illness_type_4": "No", |
||||
"illness_type_8": "No", |
||||
"illness_type_5": "No", |
||||
"illness_type_6": "No", |
||||
"illness_type_7": "No", |
||||
"illness_type_9": "No", |
||||
"illness_type_10": "No", |
||||
"condition_effects_prefer_not_to_say": "Yes", |
||||
"rp_homeless": "Yes", |
||||
"rp_insan_unsat": "No", |
||||
"rp_medwel": "No", |
||||
"rp_hardship": "No", |
||||
"rp_dontknow": "No", |
||||
"discarded_at": "05/05/2020", |
||||
"override_net_income_validation": "", |
||||
"gdpr_acceptance": "", |
||||
"gdpr_declined": "", |
||||
"property_owner_organisation": "", |
||||
"property_manager_organisation": "", |
||||
"sale_or_letting": "", |
||||
"tenant_same_property_renewal": "", |
||||
"rent_type": "", |
||||
"intermediate_rent_product_name": "", |
||||
"needs_type": "", |
||||
"sale_completion_date": "", |
||||
"purchaser_code": "", |
||||
"propcode": "123", |
||||
"majorrepairs": "Yes", |
||||
"postcode": "a1", |
||||
"postcod2": "w3", |
||||
"ppostc1": "w3", |
||||
"ppostc2": "w3" |
||||
} |
||||
} |
||||
|
@ -0,0 +1,180 @@
|
||||
{ |
||||
"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" } |
||||
}, |
||||
"default_next_page": "gdpr_declined" |
||||
}, |
||||
"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": { |
||||
|
||||
}, |
||||
"default_next_page" : "check_answers" |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
}, |
||||
"conditional_route_to": { |
||||
"tenant_same_property_renewal": { "sale_or_letting": "Letting" } |
||||
}, |
||||
"default_next_page" : "check_answers" |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
}, |
||||
"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" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe SoftValidationsController, type: :request do |
||||
let(:params) { { case_log_id: case_log.id } } |
||||
let(:url) { "/case_logs/#{case_log.id}/net_income/soft_validations" } |
||||
|
||||
before do |
||||
get url, params: {} |
||||
end |
||||
|
||||
describe "GET #show" do |
||||
context "Soft validation overide required" do |
||||
let(:case_log) { FactoryBot.create(:case_log, :soft_validations_triggered) } |
||||
|
||||
it "returns a success response" do |
||||
expect(response).to be_successful |
||||
end |
||||
|
||||
it "returns a json with the soft validation fields" do |
||||
json_response = JSON.parse(response.body) |
||||
expect(json_response["show"]).to eq(true) |
||||
expect(json_response["label"]).to match(/Are you sure this is correct?/) |
||||
end |
||||
end |
||||
|
||||
context "Soft validation overide not required" do |
||||
let(:case_log) { FactoryBot.create(:case_log, :in_progress) } |
||||
|
||||
it "returns a success response" do |
||||
expect(response).to be_successful |
||||
end |
||||
|
||||
it "returns a json with the soft validation fields" do |
||||
json_response = JSON.parse(response.body) |
||||
expect(json_response["show"]).to eq(false) |
||||
end |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue