app/models/bulkrax/exporter.rb in bulkrax-3.5.1 vs app/models/bulkrax/exporter.rb in bulkrax-4.0.0

- old
+ new

@@ -122,20 +122,33 @@ def exporter_export_path @exporter_export_path ||= File.join(parser.base_path('export'), self.id.to_s, self.exporter_runs.last.id.to_s) end def exporter_export_zip_path - @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_#{self.exporter_runs.last.id}.zip") + @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_#{self.exporter_runs.last.id}") rescue - @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_0.zip") + @exporter_export_zip_path ||= File.join(parser.base_path('export'), "export_#{self.id}_0") end + def exporter_export_zip_files + @exporter_export_zip_files ||= Dir["#{exporter_export_zip_path}/**"].map { |zip| Array(zip.split('/').last) } + end + def export_properties properties = Hyrax.config.registered_curation_concern_types.map { |work| work.constantize.properties.keys }.flatten.uniq.sort properties.reject { |prop| Bulkrax.reserved_properties.include?(prop) } end def metadata_only? export_type == 'metadata' + end + + def sort_zip_files(zip_files) + zip_files.sort_by do |item| + number = item.split('_').last.match(/\d+/)&.[](0) || 0.to_s + sort_number = number.rjust(4, "0") + + sort_number + end end end end