|
|
@ -77,14 +77,13 @@ module Exports |
|
|
|
|
|
|
|
|
|
|
|
logs_count = retrieve_lettings_logs(start_time, recent_export, full_update).filter_by_year(collection).count |
|
|
|
logs_count = retrieve_lettings_logs(start_time, recent_export, full_update).filter_by_year(collection).count |
|
|
|
@logger.info("Creating #{archive} - #{logs_count} logs") |
|
|
|
@logger.info("Creating #{archive} - #{logs_count} logs") |
|
|
|
manifest_xml = build_manifest_xml(logs_count) |
|
|
|
|
|
|
|
return {} if logs_count.zero? |
|
|
|
return {} if logs_count.zero? |
|
|
|
|
|
|
|
|
|
|
|
zip_file = Zip::File.open_buffer(StringIO.new) |
|
|
|
zip_file = Zip::File.open_buffer(StringIO.new) |
|
|
|
zip_file.add("manifest.xml", manifest_xml) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
part_number = 1 |
|
|
|
part_number = 1 |
|
|
|
last_processed_marker = nil |
|
|
|
last_processed_marker = nil |
|
|
|
|
|
|
|
total_logs = 0 |
|
|
|
|
|
|
|
|
|
|
|
loop do |
|
|
|
loop do |
|
|
|
lettings_logs_slice = if last_processed_marker.present? |
|
|
|
lettings_logs_slice = if last_processed_marker.present? |
|
|
@ -105,9 +104,13 @@ module Exports |
|
|
|
zip_file.add("#{archive}_#{part_number_str}.xml", data_xml) |
|
|
|
zip_file.add("#{archive}_#{part_number_str}.xml", data_xml) |
|
|
|
part_number += 1 |
|
|
|
part_number += 1 |
|
|
|
last_processed_marker = lettings_logs_slice.last.created_at |
|
|
|
last_processed_marker = lettings_logs_slice.last.created_at |
|
|
|
|
|
|
|
total_logs += lettings_logs_slice.count |
|
|
|
@logger.info("Added #{archive}_#{part_number_str}.xml") |
|
|
|
@logger.info("Added #{archive}_#{part_number_str}.xml") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
manifest_xml = build_manifest_xml(logs_count) |
|
|
|
|
|
|
|
zip_file.add("manifest.xml", manifest_xml) |
|
|
|
|
|
|
|
|
|
|
|
# Required by S3 to avoid Aws::S3::Errors::BadDigest |
|
|
|
# Required by S3 to avoid Aws::S3::Errors::BadDigest |
|
|
|
zip_io = zip_file.write_buffer |
|
|
|
zip_io = zip_file.write_buffer |
|
|
|
zip_io.rewind |
|
|
|
zip_io.rewind |
|
|
|