From 233c69eb272f1d3b4bf3777524dee773f9ef930a Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Wed, 14 Jan 2026 16:17:07 +0000 Subject: [PATCH 1/4] CLDC-4156: Update Scheme Care options now uses 1,2,5 as options --- app/models/scheme.rb | 9 ++++----- app/views/schemes/details.html.erb | 6 +----- app/views/schemes/new.html.erb | 6 +----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index f563573b5..50f94bbbc 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -148,9 +148,8 @@ class Scheme < ApplicationRecord enum :sensitive, SENSITIVE, suffix: true REGISTERED_UNDER_CARE_ACT = { - "Yes – registered care home providing nursing care": 4, - "Yes – registered care home providing personal care": 3, - "Yes – part registered as a care home": 2, + "Yes": 5, + "Partially - some but not all units in the scheme are regulated by the CQC": 2, "No": 1, }.freeze @@ -262,10 +261,10 @@ class Scheme < ApplicationRecord ] end - def care_acts_options_with_hints + def self.care_acts_options_with_hints hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } - Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints[key.to_sym]) } + Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s, description: hints[key.to_sym]) } end def support_level_options_with_hints diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb index d1943cabe..6a459263f 100644 --- a/app/views/schemes/details.html.erb +++ b/app/views/schemes/details.html.erb @@ -38,12 +38,8 @@ :name, legend: { text: "What is this type of scheme?", size: "m" } %> - <% care_acts_options_hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } %> - - <% care_acts_options_with_hints = Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: care_acts_options_hints[key.to_sym]) } %> - <%= f.govuk_collection_radio_buttons :registered_under_care_act, - care_acts_options_with_hints, + Scheme.care_acts_options_with_hints, :id, :name, :description, diff --git a/app/views/schemes/new.html.erb b/app/views/schemes/new.html.erb index 1be0f7f74..1869e6ee3 100644 --- a/app/views/schemes/new.html.erb +++ b/app/views/schemes/new.html.erb @@ -33,12 +33,8 @@ :name, legend: { text: "What is this type of scheme?", size: "m" } %> - <% care_acts_options_hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } %> - - <% care_acts_options_with_hints = Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: care_acts_options_hints[key.to_sym]) } %> - <%= f.govuk_collection_radio_buttons :registered_under_care_act, - care_acts_options_with_hints, + Scheme.care_acts_options_with_hints, :id, :name, :description, From b81ac1c7e467cef551d103b11e05d4276a75c77f Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Wed, 14 Jan 2026 16:17:23 +0000 Subject: [PATCH 2/4] CLDC-4156: Migrate existing scheme options --- .../20260114160036_update_scheme_care_standards_values.rb | 5 +++++ db/schema.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20260114160036_update_scheme_care_standards_values.rb diff --git a/db/migrate/20260114160036_update_scheme_care_standards_values.rb b/db/migrate/20260114160036_update_scheme_care_standards_values.rb new file mode 100644 index 000000000..f1a256962 --- /dev/null +++ b/db/migrate/20260114160036_update_scheme_care_standards_values.rb @@ -0,0 +1,5 @@ +class UpdateSchemeCareStandardsValues < ActiveRecord::Migration[7.2] + def change + Scheme.where(registered_under_care_act: [3, 4]).update!(registered_under_care_act: 5) + end +end diff --git a/db/schema.rb b/db/schema.rb index 50aa1a81d..20cfe5a43 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[7.2].define(version: 2025_04_16_111741) do +ActiveRecord::Schema[7.2].define(version: 2026_01_14_160036) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -84,7 +84,7 @@ ActiveRecord::Schema[7.2].define(version: 2025_04_16_111741) do t.datetime "last_accessed" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.check_constraint "log_type::text = ANY (ARRAY['lettings'::character varying, 'sales'::character varying]::text[])", name: "log_type_check" + t.check_constraint "log_type::text = ANY (ARRAY['lettings'::character varying::text, 'sales'::character varying::text])", name: "log_type_check" t.check_constraint "year >= 2000 AND year <= 2099", name: "year_check" end From c7dd056ba2eae959eea4bde0a943e239ef1cc3a3 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Wed, 14 Jan 2026 16:38:36 +0000 Subject: [PATCH 3/4] CLDC-4156: Update tests --- spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb index c397b456a..7fce53bfd 100644 --- a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb +++ b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "bulk_update" do 3, service_name: "Test name", sensitive: 1, - registered_under_care_act: 4, + registered_under_care_act: 5, support_type: 4, scheme_type: 7, arrangement_type: "D", From ede2c4979bbbaadb62b634e4bd600a2811f673a2 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Wed, 14 Jan 2026 16:53:24 +0000 Subject: [PATCH 4/4] fixup! CLDC-4156: Update tests replace old Yes options --- spec/features/schemes_helpers.rb | 2 +- spec/fixtures/files/original_schemes.csv | 10 +++++----- spec/fixtures/files/updated_schemes.csv | 4 ++-- .../update_schemes_and_locations_from_csv_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index 0b99d54de..e14c65cbf 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -29,7 +29,7 @@ module SchemesHelpers fill_in "Scheme name", with: "FooBar" check "This scheme contains confidential information" choose "Direct access hostel" - choose "Yes – registered care home providing nursing care" + choose "Yes" select organisation_name, from: "scheme-owning-organisation-id-field" choose answers["housing_stock_owners"].presence || "The same organisation that owns the housing stock" click_button "Save and continue" diff --git a/spec/fixtures/files/original_schemes.csv b/spec/fixtures/files/original_schemes.csv index f28bbedbb..a068a132c 100644 --- a/spec/fixtures/files/original_schemes.csv +++ b/spec/fixtures/files/original_schemes.csv @@ -1,6 +1,6 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates -{id1},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id3},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id4},Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id1},Test name,active,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id2},Test name,active,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id3},Test name,active,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id4},Incomplete scheme,incomplete,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" diff --git a/spec/fixtures/files/updated_schemes.csv b/spec/fixtures/files/updated_schemes.csv index 5f4631a02..5091ea2de 100644 --- a/spec/fixtures/files/updated_schemes.csv +++ b/spec/fixtures/files/updated_schemes.csv @@ -1,6 +1,6 @@ scheme_code,scheme_service_name,scheme_status,scheme_confidential,scheme_type,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_support_services_provided_by,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,scheme_active_dates {id1},Updated test name,incomplete,No,Direct Access Hostel,No,Different organisation,Another registered stock owner,People with drug problems,No,Older people with support needs,Low level,Permanent,2022-04-01T00:00:00+01:00,"Active from 2 April 2020" -{id2},Test name,active,Yes,Housing for older people,Yes – registered care home providing nursing care,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" -{id3}, ,active,Yse,Direct access Hostel,Yes – registered care home providing nursing care,non existing org,wrong answer,FD,no,lder people with support needs,high,Permanent ,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id2},Test name,active,Yes,Housing for older people,Yes,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,Yes,Older people with support needs,High level,Medium stay,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" +{id3}, ,active,Yse,Direct access Hostel,Yes,non existing org,wrong answer,FD,no,lder people with support needs,high,Permanent ,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" Wrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" SWrong_id,Incomplete scheme,incomplete,Yes,Housing for older people,No,MHCLG,The same organisation that owns the housing stock,People with alcohol problems,,,,,2021-04-01T00:00:00+01:00,"Active from 1 April 2020" diff --git a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb index 7fce53bfd..6c8aa25ed 100644 --- a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb +++ b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb @@ -123,7 +123,7 @@ RSpec.describe "bulk_update" do schemes[1].reload expect(schemes[1].service_name).to eq("Test name") expect(schemes[1].sensitive).to eq("Yes") - expect(schemes[1].registered_under_care_act).to eq("Yes – registered care home providing nursing care") + expect(schemes[1].registered_under_care_act).to eq("Yes") expect(schemes[1].support_type).to eq("High level") expect(schemes[1].scheme_type).to eq("Housing for older people") expect(schemes[1].arrangement_type).to eq("The same organisation that owns the housing stock") @@ -141,7 +141,7 @@ RSpec.describe "bulk_update" do schemes[2].reload expect(schemes[2].service_name).to eq("Test name") expect(schemes[2].sensitive).to eq("Yes") - expect(schemes[2].registered_under_care_act).to eq("Yes – registered care home providing nursing care") + expect(schemes[2].registered_under_care_act).to eq("Yes") expect(schemes[2].support_type).to eq("High level") expect(schemes[2].scheme_type).to eq("Housing for older people") expect(schemes[2].arrangement_type).to eq("The same organisation that owns the housing stock")