Browse Source

Merge d9fe00339d into 520e46086f

pull/3142/merge
Samuel Young 3 days ago committed by GitHub
parent
commit
504d572cd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      app/models/scheme.rb
  2. 8
      app/views/schemes/details.html.erb
  3. 8
      app/views/schemes/new.html.erb
  4. 4
      lib/tasks/update_scheme_registered_under_care_value.rake
  5. 2
      spec/features/schemes_helpers.rb
  6. 4
      spec/features/schemes_spec.rb
  7. 10
      spec/fixtures/files/original_schemes.csv
  8. 4
      spec/fixtures/files/updated_schemes.csv
  9. 6
      spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb

13
app/models/scheme.rb

@ -148,9 +148,8 @@ class Scheme < ApplicationRecord
enum :sensitive, SENSITIVE, suffix: true enum :sensitive, SENSITIVE, suffix: true
REGISTERED_UNDER_CARE_ACT = { REGISTERED_UNDER_CARE_ACT = {
"Yes – registered care home providing nursing care": 4, "Yes": 5,
"Yes – registered care home providing personal care": 3, "Partially - some but not all units in the scheme are regulated by the CQC": 2,
"Yes – part registered as a care home": 2,
"No": 1, "No": 1,
}.freeze }.freeze
@ -251,7 +250,7 @@ class Scheme < ApplicationRecord
{ name: "Status", value: status, id: "status" }, { name: "Status", value: status, id: "status" },
{ name: "Confidential information", value: sensitive, id: "sensitive", edit: true }, { name: "Confidential information", value: sensitive, id: "sensitive", edit: true },
{ name: "Type of scheme", value: scheme_type, id: "scheme_type", edit: true }, { name: "Type of scheme", value: scheme_type, id: "scheme_type", edit: true },
{ name: "Registered under Care Standards Act 2000", value: registered_under_care_act, id: "registered_under_care_act", edit: true }, { name: "Regulated by the Care Quality Commission", value: registered_under_care_act, id: "registered_under_care_act", edit: true },
{ name: "Housing stock owned by", value: owning_organisation.name, id: "owning_organisation_id", edit: true }, { name: "Housing stock owned by", value: owning_organisation.name, id: "owning_organisation_id", edit: true },
{ name: "Support services provided by", value: arrangement_type, id: "arrangement_type", edit: true }, { name: "Support services provided by", value: arrangement_type, id: "arrangement_type", edit: true },
{ name: "Primary client group", value: primary_client_group, id: "primary_client_group", edit: true }, { name: "Primary client group", value: primary_client_group, id: "primary_client_group", edit: true },
@ -262,10 +261,8 @@ class Scheme < ApplicationRecord
] ]
end end
def care_acts_options_with_hints def self.care_acts_options
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) }
Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints[key.to_sym]) }
end end
def support_level_options_with_hints def support_level_options_with_hints

8
app/views/schemes/details.html.erb

@ -38,16 +38,12 @@
:name, :name,
legend: { text: "What is this type of scheme?", size: "m" } %> 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, <%= f.govuk_collection_radio_buttons :registered_under_care_act,
care_acts_options_with_hints, Scheme.care_acts_options,
:id, :id,
:name, :name,
:description, :description,
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> legend: { text: "Is the scheme regulated by the Care Quality Commission (CQC)?", size: "m" } %>
<% scheme_owning_organisation_options = owning_organisation_options(current_user) %> <% scheme_owning_organisation_options = owning_organisation_options(current_user) %>

8
app/views/schemes/new.html.erb

@ -33,16 +33,12 @@
:name, :name,
legend: { text: "What is this type of scheme?", size: "m" } %> 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, <%= f.govuk_collection_radio_buttons :registered_under_care_act,
care_acts_options_with_hints, Scheme.care_acts_options,
:id, :id,
:name, :name,
:description, :description,
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> legend: { text: "Is the scheme regulated by the Care Quality Commission (CQC)?", size: "m" } %>
<% if current_user.data_coordinator? && current_user.organisation.stock_owners.count.zero? && !current_user.organisation.has_recent_absorbed_organisations? %> <% if current_user.data_coordinator? && current_user.organisation.stock_owners.count.zero? && !current_user.organisation.has_recent_absorbed_organisations? %>
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> <%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %>

4
lib/tasks/update_scheme_registered_under_care_value.rake

@ -0,0 +1,4 @@
desc "Alter registered under care act values for schemes in the database to 5 if they are 3 or 4, as these options are being deprecated"
task update_scheme_registered_under_care_value: :environment do
Scheme.where(registered_under_care_act: [3, 4]).update_all(registered_under_care_act: 5)
end

2
spec/features/schemes_helpers.rb

@ -29,7 +29,7 @@ module SchemesHelpers
fill_in "Scheme name", with: "FooBar" fill_in "Scheme name", with: "FooBar"
check "This scheme contains confidential information" check "This scheme contains confidential information"
choose "Direct access hostel" choose "Direct access hostel"
choose "Yes – registered care home providing nursing care" choose "Yes"
select organisation_name, from: "scheme-owning-organisation-id-field" select organisation_name, from: "scheme-owning-organisation-id-field"
choose answers["housing_stock_owners"].presence || "The same organisation that owns the housing stock" choose answers["housing_stock_owners"].presence || "The same organisation that owns the housing stock"
click_button "Save and continue" click_button "Save and continue"

4
spec/features/schemes_spec.rb

@ -446,7 +446,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "This scheme contains confidential information" expect(page).to have_content "This scheme contains confidential information"
expect(page).to have_content "Which organisation owns the housing stock for this scheme?" expect(page).to have_content "Which organisation owns the housing stock for this scheme?"
expect(page).to have_content "What is this type of scheme?" expect(page).to have_content "What is this type of scheme?"
expect(page).to have_content "Is this scheme registered under the Care Standards Act 2000?" expect(page).to have_content "Is the scheme regulated by the Care Quality Commission (CQC)?"
expect(page).to have_content "Who provides the support services used by this scheme?" expect(page).to have_content "Who provides the support services used by this scheme?"
end end
@ -463,7 +463,7 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "This scheme contains confidential information" expect(page).to have_content "This scheme contains confidential information"
expect(page).to have_content "What is this type of scheme?" expect(page).to have_content "What is this type of scheme?"
expect(page).to have_content "Who provides the support services used by this scheme?" expect(page).to have_content "Who provides the support services used by this scheme?"
expect(page).to have_content "Is this scheme registered under the Care Standards Act 2000?" expect(page).to have_content "Is the scheme regulated by the Care Quality Commission (CQC)?"
end end
it "returns to the primary client group question after amending scheme details" do it "returns to the primary client group question after amending scheme details" do

10
spec/fixtures/files/original_schemes.csv vendored

@ -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 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" {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 – 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,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" {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 – 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" {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 – 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,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"

1 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
2 {id1} Test name active Yes Housing for older people Yes – registered care home providing nursing care 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
3 {id2} Test name active Yes Housing for older people Yes – registered care home providing nursing care 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
4 {id3} Test name active Yes Housing for older people Yes – registered care home providing nursing care 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
5 {id4} Incomplete scheme incomplete Yes Housing for older people Yes – registered care home providing nursing care 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
6 SWrong_id Incomplete scheme incomplete Yes Housing for older people Yes – registered care home providing nursing care 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

4
spec/fixtures/files/updated_schemes.csv vendored

@ -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 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" {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" {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 – 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" {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" 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" 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"

1 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
2 {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
3 {id2} Test name active Yes Housing for older people Yes – registered care home providing nursing care 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
4 {id3} active Yse Direct access Hostel Yes – registered care home providing nursing care 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
5 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
6 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

6
spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb

@ -57,7 +57,7 @@ RSpec.describe "bulk_update" do
3, 3,
service_name: "Test name", service_name: "Test name",
sensitive: 1, sensitive: 1,
registered_under_care_act: 4, registered_under_care_act: 5,
support_type: 4, support_type: 4,
scheme_type: 7, scheme_type: 7,
arrangement_type: "D", arrangement_type: "D",
@ -123,7 +123,7 @@ RSpec.describe "bulk_update" do
schemes[1].reload schemes[1].reload
expect(schemes[1].service_name).to eq("Test name") expect(schemes[1].service_name).to eq("Test name")
expect(schemes[1].sensitive).to eq("Yes") 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].support_type).to eq("High level")
expect(schemes[1].scheme_type).to eq("Housing for older people") 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") 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 schemes[2].reload
expect(schemes[2].service_name).to eq("Test name") expect(schemes[2].service_name).to eq("Test name")
expect(schemes[2].sensitive).to eq("Yes") 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].support_type).to eq("High level")
expect(schemes[2].scheme_type).to eq("Housing for older people") 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") expect(schemes[2].arrangement_type).to eq("The same organisation that owns the housing stock")

Loading…
Cancel
Save