Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guard to method #213

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/services/iiif_print/manifest_builder_service_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ def sanitize_v3(hash:, presenter:)

def apply_metadata_to_canvas(canvas:, presenter:)
return if @child_works.empty?

parent_and_child_solr_hits = parent_and_child_solr_hits(presenter)
# uses the 'id' property for v3 manifest and `@id' for v2, which is a URL that contains the FileSet id
file_set_id = (canvas['id'] || canvas['@id']).split('/').last
# finds the image that the FileSet is attached to and creates metadata on that canvas
image = parent_and_child_solr_hits.find { |doc| doc[:member_ids_ssim]&.include?(file_set_id) }

return unless image
canvas_metadata = IiifPrint.manifest_metadata_from(work: image, presenter: presenter)
canvas['metadata'] = canvas_metadata
end
Expand Down