From 3d814211c5288e33aa2a5c70ac8be04b1363c59b Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Tue, 2 Apr 2024 11:32:59 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20Adding=20TODO=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/concerns/bulkrax/export_behavior.rb | 1 + app/parsers/bulkrax/csv_parser.rb | 4 ++++ app/services/bulkrax/remove_relationships_for_importer.rb | 2 ++ 3 files changed, 7 insertions(+) diff --git a/app/models/concerns/bulkrax/export_behavior.rb b/app/models/concerns/bulkrax/export_behavior.rb index 14fbfc6d..4cfa8513 100644 --- a/app/models/concerns/bulkrax/export_behavior.rb +++ b/app/models/concerns/bulkrax/export_behavior.rb @@ -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) diff --git a/app/parsers/bulkrax/csv_parser.rb b/app/parsers/bulkrax/csv_parser.rb index e885ff79..03159ebb 100644 --- a/app/parsers/bulkrax/csv_parser.rb +++ b/app/parsers/bulkrax/csv_parser.rb @@ -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) @@ -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' diff --git a/app/services/bulkrax/remove_relationships_for_importer.rb b/app/services/bulkrax/remove_relationships_for_importer.rb index 65a9371b..1195b505 100644 --- a/app/services/bulkrax/remove_relationships_for_importer.rb +++ b/app/services/bulkrax/remove_relationships_for_importer.rb @@ -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