From 8d09c167d3d6092922cf90683bb8539665eb965e Mon Sep 17 00:00:00 2001 From: Thomas Wrobel Date: Thu, 6 May 2021 22:59:50 +0100 Subject: [PATCH] Set licence_url from licence using licences service Set the licence_url from the licence if the licence_url is not set (and if the licence_url can be mapped). Uses the Hyrax Licences service and the configuration used to power to front end webform. Required by #2 --- app/services/willow_sword/assign_mets_to_model.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/services/willow_sword/assign_mets_to_model.rb b/app/services/willow_sword/assign_mets_to_model.rb index 8de5cf3..278d948 100644 --- a/app/services/willow_sword/assign_mets_to_model.rb +++ b/app/services/willow_sword/assign_mets_to_model.rb @@ -866,7 +866,12 @@ def assign_record_info info_note_fields.each do |data_fld, model_fld| vals = Array(@metadata['recordInfoNote'].fetch(data_fld, [])) if admin_fields.include? model_fld - admin_attrs[model_fld] = vals[0] if vals.any? + if model_fld == 'ora_collection' + # ora_collection is mutlivalued + admin_attrs[model_fld] = vals if vals.any? + else + admin_attrs[model_fld] = vals[0] if vals.any? + end elsif bib_fields.include? model_fld bib_attrs[model_fld] = vals[0] if vals.any? elsif license_fields.include? model_fld @@ -877,7 +882,7 @@ def assign_record_info # data responsbility was put in license and rights vals = Array(@metadata.fetch('dataset_responsibility', [])) - licence_attrs['data_responsibility'] = vals[0] if vals.any? + license_attrs['data_responsibility'] = vals[0] if vals.any? assign_nested_hash('admin_information', admin_attrs) if admin_attrs.any? assign_nested_hash('bibliographic_information', bib_attrs) if bib_attrs.any?