From a7d8ea64f2e0486df3b4300f766f635fc643fcf6 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Fri, 13 Jan 2023 16:45:37 -0500 Subject: [PATCH 1/2] Put guards around access statement derivation to ignore weird old combinations --- lib/oai_solr/dublin_core.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/oai_solr/dublin_core.rb b/lib/oai_solr/dublin_core.rb index 1731172..5cfaec5 100644 --- a/lib/oai_solr/dublin_core.rb +++ b/lib/oai_solr/dublin_core.rb @@ -69,8 +69,16 @@ def description(record) record.marc_record.fields("974").each do |field| rights_attr = field["r"] access_profile = access_profile(field["c"], field["s"]) - - statements.add Services.rights_database.access_statements_map.map[[rights_attr, access_profile]] + if access_profile.nil? + logger.error "Access profile not found for #{field.to_s}" + next + end + statement = Services.rights_database.access_statements_map[attribute: rights_attr, access_profile: access_profile] + if statement.nil? + logger.error("Access statement not found for #{field.to_s}") + next + end + statements.add statement end statements.to_a.sort_by(&:head) end From 3cded3864fbcc58000b7ece40aa7e0bb3d6ae7b9 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Fri, 13 Jan 2023 21:32:13 -0500 Subject: [PATCH 2/2] standardrb --- lib/oai_solr/dublin_core.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/oai_solr/dublin_core.rb b/lib/oai_solr/dublin_core.rb index 5cfaec5..da8e3fc 100644 --- a/lib/oai_solr/dublin_core.rb +++ b/lib/oai_solr/dublin_core.rb @@ -70,12 +70,12 @@ def description(record) rights_attr = field["r"] access_profile = access_profile(field["c"], field["s"]) if access_profile.nil? - logger.error "Access profile not found for #{field.to_s}" + logger.error "Access profile not found for #{field}" next end statement = Services.rights_database.access_statements_map[attribute: rights_attr, access_profile: access_profile] if statement.nil? - logger.error("Access statement not found for #{field.to_s}") + logger.error("Access statement not found for #{field}") next end statements.add statement