From 00bf179f6e11a6ea0427ca3025b157731eec87c6 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 13 Dec 2023 10:38:01 +0000 Subject: [PATCH] feat: only include location LA name, and rename to location_local_authority --- app/services/csv/scheme_csv_service.rb | 5 ++--- spec/fixtures/files/locations_csv_export.csv | 4 ++-- spec/fixtures/files/schemes_and_locations_csv_export.csv | 4 ++-- spec/services/csv/scheme_csv_service_spec.rb | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/services/csv/scheme_csv_service.rb b/app/services/csv/scheme_csv_service.rb index ca405e278..ae7f7b96b 100644 --- a/app/services/csv/scheme_csv_service.rb +++ b/app/services/csv/scheme_csv_service.rb @@ -49,11 +49,10 @@ module Csv "location_postcode" => "postcode", "location_name" => "name", "location_status" => "status", - "location_local_authority" => "location_code", + "location_local_authority" => "location_admin_district", "location_units" => "units", "location_type_of_unit" => "type_of_unit", "location_mobility_type" => "mobility_type", - "location_admin_district" => "location_admin_district", }.freeze CUSTOM_CALL_CHAINS = { @@ -92,7 +91,7 @@ module Csv end def location_attributes - %w[location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_admin_district location_active_dates] + %w[location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_active_dates] end def attributes diff --git a/spec/fixtures/files/locations_csv_export.csv b/spec/fixtures/files/locations_csv_export.csv index 6ef80bfa1..3322e165d 100644 --- a/spec/fixtures/files/locations_csv_export.csv +++ b/spec/fixtures/files/locations_csv_export.csv @@ -1,2 +1,2 @@ -scheme_code,location_code,location_postcode,location_name,location_status,location_local_authority,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_active_dates -,,SW1A 2AA,Downing Street,active,E09000033,20,Self-contained house,Fitted with equipment and adaptations,Westminster,Active from 1 April 2022 +scheme_code,location_code,location_postcode,location_name,location_status,location_local_authority,location_units,location_type_of_unit,location_mobility_type,location_active_dates +,,SW1A 2AA,Downing Street,active,Westminster,20,Self-contained house,Fitted with equipment and adaptations,Active from 1 April 2022 diff --git a/spec/fixtures/files/schemes_and_locations_csv_export.csv b/spec/fixtures/files/schemes_and_locations_csv_export.csv index a273b73c9..180cc35a9 100644 --- a/spec/fixtures/files/schemes_and_locations_csv_export.csv +++ b/spec/fixtures/files/schemes_and_locations_csv_export.csv @@ -1,2 +1,2 @@ -scheme_code,scheme_service_name,scheme_status,scheme_sensitive,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,location_code,location_postcode,location_name,location_status,location_local_authority,location_units,location_type_of_unit,location_mobility_type,location_admin_district,location_active_dates -,Test name,active,Yes,Housing for older people,No,DLUHC,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,,SW1A 2AA,Downing Street,active,E09000033,20,Self-contained house,Fitted with equipment and adaptations,Westminster,Active from 1 April 2022 +scheme_code,scheme_service_name,scheme_status,scheme_sensitive,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,location_code,location_postcode,location_name,location_status,location_local_authority,location_units,location_type_of_unit,location_mobility_type,location_active_dates +,Test name,active,Yes,Housing for older people,No,DLUHC,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,,SW1A 2AA,Downing Street,active,Westminster,20,Self-contained house,Fitted with equipment and adaptations,Active from 1 April 2022 diff --git a/spec/services/csv/scheme_csv_service_spec.rb b/spec/services/csv/scheme_csv_service_spec.rb index 6908bb983..7a8ef3e63 100644 --- a/spec/services/csv/scheme_csv_service_spec.rb +++ b/spec/services/csv/scheme_csv_service_spec.rb @@ -70,7 +70,7 @@ RSpec.describe Csv::SchemeCsvService do context "when download type is locations" do let(:download_type) { "locations" } - let(:location_attributes) { %w[scheme_code location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_admin_district location_active_dates] } + let(:location_attributes) { %w[scheme_code location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_active_dates] } it "has the correct headers" do expect(headers).to eq(location_attributes) @@ -105,7 +105,7 @@ RSpec.describe Csv::SchemeCsvService do end context "when download type is combined" do - let(:combined_attributes) { %w[scheme_code scheme_service_name scheme_status scheme_sensitive 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 location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_admin_district location_active_dates] } + let(:combined_attributes) { %w[scheme_code scheme_service_name scheme_status scheme_sensitive 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 location_code location_postcode location_name location_status location_local_authority location_units location_type_of_unit location_mobility_type location_active_dates] } it "has the correct headers" do expect(headers).to eq(combined_attributes)