Browse Source

Set imported at date for lettings logs

pull/1873/head
Kat 3 years ago
parent
commit
01558f8703
  1. 1
      app/services/imports/lettings_logs_import_service.rb
  2. 7
      spec/services/imports/lettings_logs_import_service_spec.rb

1
app/services/imports/lettings_logs_import_service.rb

@ -271,6 +271,7 @@ module Imports
attributes["created_by"] = user attributes["created_by"] = user
end end
attributes["imported_at"] = Time.zone.now
apply_date_consistency!(attributes) apply_date_consistency!(attributes)
apply_household_consistency!(attributes) apply_household_consistency!(attributes)

7
spec/services/imports/lettings_logs_import_service_spec.rb

@ -159,6 +159,13 @@ RSpec.describe Imports::LettingsLogsImportService do
end end
end end
it "correctly sets imported at date" do
lettings_log_service.send(:create_log, lettings_log_xml)
lettings_log = LettingsLog.where(old_id: lettings_log_id).first
expect(lettings_log&.imported_at).to eq(Time.zone.local(2022, 1, 1))
end
context "and the void date is after the start date" do context "and the void date is after the start date" do
before { lettings_log_xml.at_xpath("//xmlns:VYEAR").content = 2023 } before { lettings_log_xml.at_xpath("//xmlns:VYEAR").content = 2023 }

Loading…
Cancel
Save