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

Illustrative content #168

Merged
merged 8 commits into from
Dec 9, 2021
Merged

Illustrative content #168

merged 8 commits into from
Dec 9, 2021

Conversation

ndushay
Copy link
Contributor

@ndushay ndushay commented Dec 9, 2021

Why was this change made?

FIxes #158 (Map bf:illustrativeContent to MARC 300b and to MARC 008/18)

There is some refactoring bundled in.

How was this change tested?

unit tests

Which documentation and/or configurations were updated?

@@ -19,6 +19,8 @@ def value
field_value[6..14] = '|||||||||'
end
field_value[15..17] = model.place
# Book Illustrative Context
field_value[18] = 'a' if model.book_illustrative_content.present?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ticket said to default this to 'a'

if illustrative_content_uri
other_physical_details = LiteralOrRemoteResolver.resolve_label(term: illustrative_content_uri, item: item)
end
extent_physical_descriptions = extent_terms.sort.map do |extent_term|
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor: ...descriptionSSSSS

Comment on lines +37 to +43
dimensions = item.instance.query.path_all_literal([BF.dimensions]).sort
if extent_physical_descriptions.length == 1 && dimensions.length == 1
return [extent_physical_descriptions.first.merge(dimensions: dimensions)]
end

extent_physical_description + [dimensions]
extent_physical_descriptions << { dimensions: dimensions } if dimensions.present?
extent_physical_descriptions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor: :dimensions is an attribute of PhysicalDescription class; the existing code was confusing to follow. Tests for more cases around multiple dimensions and multiple physical_decriptions were also added.

'300 $a extent1 $a extent2 $c dimension1 $c dimension2 $3 materials_specified1',
'300 $3 materials_specified2'
]
context 'with single extents and dimensions in multiple physical descriptions' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new test added for pre-exisitng code

@@ -52,6 +51,34 @@
include_examples 'mapper', described_class
end

context 'with a single extent and multiple dimensions' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new test added for pre-existing code

@justinlittman justinlittman merged commit 997881f into main Dec 9, 2021
@justinlittman justinlittman deleted the illustrative-content branch December 9, 2021 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Map bf:illustrativeContent to MARC
2 participants