Skip to content

Commit

Permalink
📚 Adding TODO items
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyf committed Apr 2, 2024
1 parent 88ac373 commit 3d81421
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/concerns/bulkrax/export_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def hyrax_record

# Prepend the file_set id to ensure a unique filename and also one that is not longer than 255 characters
def filename(file_set)
# NOTE: Will this work with Valkyrie?
return if file_set.original_file.blank?
fn = file_set.original_file.file_name.first
mime = ::Marcel::MimeType.for(file_set.original_file.mime_type)
Expand Down
4 changes: 4 additions & 0 deletions app/parsers/bulkrax/csv_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def write_files
CSV.open(setup_export_file(folder_count), "w", headers: export_headers, write_headers: true) do |csv|
group.each do |entry|
csv << entry.parsed_metadata
# TODO: This is precarious when we have descendents of Bulkrax::CsvCollectionEntry
next if importerexporter.metadata_only? || entry.type == 'Bulkrax::CsvCollectionEntry'

store_files(entry.identifier, folder_count.to_s)
Expand Down Expand Up @@ -292,6 +293,9 @@ def object_names

def sort_entries(entries)
# always export models in the same order: work, collection, file set
#
# TODO: This is a problem in that only these classes are compared. Instead
# We should add a comparison operator to the classes.
entries.sort_by do |entry|
case entry.type
when 'Bulkrax::CsvCollectionEntry'
Expand Down
2 changes: 2 additions & 0 deletions app/services/bulkrax/remove_relationships_for_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ def remove_relationships_from_collection(collection)

return if defined?(Hyrax)

# NOTE: This should not need to be migrated to the object factory.
# Remove parent collection relationships
collection.member_of_collections.each do |parent_col|
Hyrax::Collections::NestedCollectionPersistenceService
.remove_nested_relationship_for(parent: parent_col, child: collection)
end

# NOTE: This should not need to be migrated to the object factory.
# Remove child collection relationships
collection.member_collections.each do |child_col|
Hyrax::Collections::NestedCollectionPersistenceService
Expand Down

0 comments on commit 3d81421

Please sign in to comment.