Sha256: 434659f2a2abe48653ffd5fa00cae52e34ae25b3c499415523c976fdb13a7cc8
Contents?: true
Size: 983 Bytes
Versions: 4
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true # ImportRunJob class class ImportRunJob < ApplicationJob queue_as :default def perform(import) data = CSV.parse(import.csv_file.download.force_encoding("UTF-8"), headers: true) data.each do |doc| extract_hash = doc.to_h converted_data = import.convert_data(extract_hash) kithe_document = { title: converted_data[GeoblacklightAdmin::Schema.instance.solr_fields[:title]], json_attributes: converted_data, friendlier_id: converted_data[GeoblacklightAdmin::Schema.instance.solr_fields[:id]], import_id: import.id } # Capture document for import attempt import_document = ImportDocument.create(kithe_document) # Add import document to background job queue ImportDocumentJob.perform_later(import_document) rescue => e logger.debug "\n\nCANNOT IMPORT: #{extract_hash.inspect}" logger.debug "Error: #{e.inspect}\n\n" next end end end
Version data entries
4 entries across 4 versions & 1 rubygems