Browse Source

Make recent logs export depend on the collection

pull/2661/head
Kat 2 years ago
parent
commit
eab806ce46
  1. 2
      app/services/exports/lettings_log_export_service.rb
  2. 2
      spec/services/exports/lettings_log_export_service_spec.rb

2
app/services/exports/lettings_log_export_service.rb

@ -5,8 +5,8 @@ module Exports
def export_xml_lettings_logs(full_update: false, collection_year: nil)
archives_for_manifest = {}
recent_export = Export.order("started_at").last
collection_years_to_export(collection_year).each do |collection|
recent_export = Export.where(collection:).order("started_at").last
base_number = Export.where(empty_export: false, collection:).maximum(:base_number) || 1
export = build_export_run(collection, base_number, full_update)
archives = write_export_archive(export, collection, recent_export, full_update)

2
spec/services/exports/lettings_log_export_service_spec.rb

@ -328,7 +328,7 @@ RSpec.describe Exports::LettingsLogExportService do
context "when this is a second export (partial)" do
before do
start_time = Time.zone.local(2022, 6, 1)
Export.new(started_at: start_time).save!
Export.new(started_at: start_time, collection: 2021).save!
end
it "does not add any entry for the master manifest (no lettings logs)" do

Loading…
Cancel
Save