From f6f4317a71fadda2a692302f10f9e2303cb07764 Mon Sep 17 00:00:00 2001 From: Kat Date: Fri, 25 Aug 2023 16:24:05 +0100 Subject: [PATCH] Set has_other_client group on import --- app/services/imports/scheme_location_import_service.rb | 3 +++ spec/services/imports/scheme_location_import_service_spec.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/app/services/imports/scheme_location_import_service.rb b/app/services/imports/scheme_location_import_service.rb index 79c35f337..b09a9cd56 100644 --- a/app/services/imports/scheme_location_import_service.rb +++ b/app/services/imports/scheme_location_import_service.rb @@ -34,6 +34,7 @@ module Imports intended_stay: attributes["intended_stay"], primary_client_group: attributes["primary_client_group"], secondary_client_group: attributes["secondary_client_group"], + has_other_client_group: attributes["has_other_client_group"], sensitive: attributes["sensitive"], # These values were set by the scheme import (management groups) owning_organisation_id: source_scheme.owning_organisation_id, @@ -56,6 +57,7 @@ module Imports support_type: attributes["support_type"], intended_stay: attributes["intended_stay"], primary_client_group: attributes["primary_client_group"], + has_other_client_group: attributes["has_other_client_group"], secondary_client_group: attributes["secondary_client_group"], sensitive: attributes["sensitive"], } @@ -83,6 +85,7 @@ module Imports attributes["primary_client_group"] = string_or_nil(xml_doc, "client-group-1") attributes["secondary_client_group"] = string_or_nil(xml_doc, "client-group-2") attributes["secondary_client_group"] = nil if attributes["primary_client_group"] == attributes["secondary_client_group"] + attributes["has_other_client_group"] = attributes["secondary_client_group"].present? ? 1 : 0 attributes["sensitive"] = sensitive(xml_doc) attributes["start_date"] = parse_date(xml_doc, "start-date") attributes["end_date"] = parse_date(xml_doc, "end-date") diff --git a/spec/services/imports/scheme_location_import_service_spec.rb b/spec/services/imports/scheme_location_import_service_spec.rb index a1e20de63..f0cbde6fe 100644 --- a/spec/services/imports/scheme_location_import_service_spec.rb +++ b/spec/services/imports/scheme_location_import_service_spec.rb @@ -162,6 +162,7 @@ RSpec.describe Imports::SchemeLocationImportService do expect(location.scheme.intended_stay).to eq("Permanent") expect(location.scheme.primary_client_group).to eq("Older people with support needs") expect(location.scheme.secondary_client_group).to be_nil + expect(location.scheme.has_other_client_group).to eq("No") expect(location.scheme.sensitive).to eq("No") expect(location.scheme.confirmed).to be_truthy end