app/parsers/bulkrax/xml_parser.rb in bulkrax-2.3.0 vs app/parsers/bulkrax/xml_parser.rb in bulkrax-3.0.0.beta1
- old
+ new
@@ -38,18 +38,18 @@
if parser_fields['import_type'] == 'multiple'
r = []
metadata_paths.map do |md|
# Retrieve all records
elements = entry_class.read_data(md).xpath("//#{record_element}")
- r += elements.map { |el| entry_class.data_for_entry(el, source_identifier) }
+ r += elements.map { |el| entry_class.data_for_entry(el, source_identifier, self) }
end
# Flatten because we may have multiple records per array
r.compact.flatten
elsif parser_fields['import_type'] == 'single'
metadata_paths.map do |md|
data = entry_class.read_data(md).xpath("//#{record_element}").first # Take only the first record
- entry_class.data_for_entry(data, source_identifier)
+ entry_class.data_for_entry(data, source_identifier, self)
end.compact # No need to flatten because we take only the first record
end
end
def record_element
@@ -92,10 +92,10 @@
if record[:delete].present?
DeleteWorkJob.send(perform_method, new_entry, current_run)
else
ImportWorkJob.send(perform_method, new_entry.id, current_run.id)
end
- increment_counters(index)
+ increment_counters(index, work: true)
end
importer.record_status
rescue StandardError => e
status_info(e)
end