Browse Source

CLDC-1941 Only add existing location and scheme fields to the export (#1279)

* Only add location and scheme fields to the export if the location and scheme exists

* Add supported housing as one of the logs in export tests
pull/1280/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
f8b3b195df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/services/exports/lettings_log_export_service.rb
  2. 2
      spec/services/exports/lettings_log_export_service_spec.rb

4
app/services/exports/lettings_log_export_service.rb

@ -198,8 +198,8 @@ module Exports
attribute_hash["sheltered"] = lettings_log.sheltered
attribute_hash["nocharge"] = lettings_log.household_charge == 1 ? 1 : nil
attribute_hash["chcharge"] = lettings_log.chcharge
add_scheme_fields!(lettings_log.scheme, attribute_hash)
add_location_fields!(lettings_log.location, attribute_hash)
add_scheme_fields!(lettings_log.scheme, attribute_hash) if lettings_log.scheme
add_location_fields!(lettings_log.location, attribute_hash) if lettings_log.location
attribute_hash.delete("unittype_gn")
end
attribute_hash

2
spec/services/exports/lettings_log_export_service_spec.rb

@ -127,7 +127,7 @@ RSpec.describe Exports::LettingsLogExportService do
context "and multiple lettings logs are available for export on same quarter" do
before do
FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 2, 1))
FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 2, 1), needstype: 2)
FactoryBot.create(:lettings_log, startdate: Time.zone.local(2022, 3, 20))
end

Loading…
Cancel
Save