diff --git a/app/models/bulkrax/csv_entry.rb b/app/models/bulkrax/csv_entry.rb index 65666890..072a86f3 100644 --- a/app/models/bulkrax/csv_entry.rb +++ b/app/models/bulkrax/csv_entry.rb @@ -68,7 +68,7 @@ def self.data_for_entry(data, _source_id, parser) end def build_metadata - validate_record + raise StandardError, 'Record not found' if record.nil? self.parsed_metadata = {} add_identifier @@ -82,15 +82,12 @@ def build_metadata sanitize_controlled_uri_values! add_local - self.parsed_metadata - end - - def validate_record - raise StandardError, 'Record not found' if record.nil? - unless importerexporter.parser.required_elements?(record) + unless importerexporter.parser.required_elements?(self.parsed_metadata) raise StandardError, "Missing required elements, missing element(s) are: "\ -"#{importerexporter.parser.missing_elements(record).join(', ')}" + "#{importerexporter.parser.missing_elements(self.parsed_metadata).join(', ')}" end + + self.parsed_metadata end def add_identifier