Browse Source

feat: only include location LA name, and rename to location_local_authority

pull/2083/head
natdeanlewissoftwire 2 years ago
parent
commit
00bf179f6e
  1. 5
      app/services/csv/scheme_csv_service.rb
  2. 4
      spec/fixtures/files/locations_csv_export.csv
  3. 4
      spec/fixtures/files/schemes_and_locations_csv_export.csv
  4. 4
      spec/services/csv/scheme_csv_service_spec.rb

5
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

4
spec/fixtures/files/locations_csv_export.csv vendored

@ -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

1 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
2 SW1A 2AA Downing Street active E09000033 Westminster 20 Self-contained house Fitted with equipment and adaptations Westminster Active from 1 April 2022

4
spec/fixtures/files/schemes_and_locations_csv_export.csv vendored

@ -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

1 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
2 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 Westminster 20 Self-contained house Fitted with equipment and adaptations Westminster Active from 1 April 2022

4
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)

Loading…
Cancel
Save