Method: CdmMigrator::CsvExportService#rows_for

Defined in:
app/services/csv_export_service.rb

#rows_for(work_ids) ⇒ Array <Array>

for a work or file set and corresponds to a csv row.

Parameters:

  • - (Array <String>)

    the work ids (for GenericWork or other work type) to export metadata for

Returns:

  • (Array <Array>)
    • An array of arrays where each nested array contains the metadata



26
27
28
29
30
31
32
33
34
35
36
# File 'app/services/csv_export_service.rb', line 26

def rows_for(work_ids)
  csv_array = [csv_headers]
  work_ids.each_with_object(csv_array).each do |work_id|
    doc = ::SolrDocument.find work_id
    csv_array << row_for(doc)
    doc._source[:file_set_ids_ssim].each do |file_id|
      file_doc = ::SolrDocument.find file_id
      csv_array << row_for(file_doc)
    end
  end
end