diff --git a/app/services/exports/lettings_log_export_service.rb b/app/services/exports/lettings_log_export_service.rb index 1819670b8..12fe2bfb4 100644 --- a/app/services/exports/lettings_log_export_service.rb +++ b/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 diff --git a/spec/services/exports/lettings_log_export_service_spec.rb b/spec/services/exports/lettings_log_export_service_spec.rb index eb8ef281f..bd7afb656 100644 --- a/spec/services/exports/lettings_log_export_service_spec.rb +++ b/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