From c9cf3636563a5a7d83bd4c972ed22a17d129324f Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:06:35 +0100 Subject: [PATCH] Add floating support type to schemes (#1984) --- app/models/scheme.rb | 3 ++- app/views/schemes/support.html.erb | 2 +- .../imports/scheme_location_import_service_spec.rb | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 63632b55f..702c8a79d 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -109,6 +109,7 @@ class Scheme < ApplicationRecord "Medium level": 3, "High level": 4, "Nursing care in a care home": 5, + "Floating support": 6, }.freeze enum support_type: SUPPORT_TYPE, _suffix: true @@ -225,7 +226,7 @@ class Scheme < ApplicationRecord "Medium level": "Staff on site daily or making frequent visits with some out-of-hours cover.", "High level": "Intensive level of staffing provided on a 24-hour basis.", } - Scheme.support_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints[key.to_sym]) } + Scheme.support_types.keys.excluding("Missing").excluding("Floating support").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints[key.to_sym]) } end def intended_length_of_stay_options_with_hints diff --git a/app/views/schemes/support.html.erb b/app/views/schemes/support.html.erb index 23948978b..be4587617 100644 --- a/app/views/schemes/support.html.erb +++ b/app/views/schemes/support.html.erb @@ -15,7 +15,7 @@ <% support_level_options_hints = { "Low level": "Staff visiting once a week, fortnightly or less.", "Medium level": "Staff on site daily or making frequent visits with some out-of-hours cover.", "High level": "Intensive level of staffing provided on a 24-hour basis." } %> - <% support_level_options_with_hints = Scheme.support_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: support_level_options_hints[key.to_sym]) } %> + <% support_level_options_with_hints = Scheme.support_types.keys.excluding("Missing").excluding("Floating support").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: support_level_options_hints[key.to_sym]) } %> <%= f.govuk_collection_radio_buttons :support_type, support_level_options_with_hints, diff --git a/spec/services/imports/scheme_location_import_service_spec.rb b/spec/services/imports/scheme_location_import_service_spec.rb index f0cbde6fe..603e572d1 100644 --- a/spec/services/imports/scheme_location_import_service_spec.rb +++ b/spec/services/imports/scheme_location_import_service_spec.rb @@ -229,6 +229,15 @@ RSpec.describe Imports::SchemeLocationImportService do end end + context "and support_type is floating support" do + before { location_xml.at_xpath("//scheme:support-type").content = "6" } + + it "correctly sets the support type" do + location = location_service.create_scheme_location(location_xml) + expect(location.scheme.support_type).to eq("Floating support") + end + end + context "and postcode does not return a location code" do before { location_xml.at_xpath("//scheme:postcode").content = "A1 1AA" }