-
Notifications
You must be signed in to change notification settings - Fork 25
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
dojson: fix LOC partOf numbering #3282
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
rerowep
commented
Mar 14, 2023
•
edited
Loading
edited
- Fixes partOf numbering creation in unimarc dojson.
- Improves code quality according to Sourcery proposals.
github-actions
bot
added
the
f: data
About data model, importation, transformation, exportation of data, specific for bibliographic data
label
Mar 14, 2023
zannkukai
approved these changes
Mar 14, 2023
rero_ils/modules/documents/dojson/contrib/unimarctojson/model.py
Outdated
Show resolved
Hide resolved
lauren-d
approved these changes
Mar 14, 2023
rerowep
force-pushed
the
wep-fix-dojson-loc-partof
branch
8 times, most recently
from
March 21, 2023 16:03
472f71f
to
fb31b83
Compare
zannkukai
approved these changes
Mar 22, 2023
Comment on lines
+485
to
+498
if subfield_v := utils.force_list(value.get('v')): | ||
# get volumes and pages split | ||
volumes_pages = subfield_v[0].split(',') | ||
# get a volume range | ||
volumes = volumes_pages[0].split('-') | ||
pages = volumes_pages[1] if len(volumes_pages) > 1 else None | ||
with contextlib.suppress(ValueError): | ||
volumes = range(int(volumes[0]), int(volumes[1]) + 1) \ | ||
if len(volumes) > 1 else [int(volumes[0])] | ||
# TODO: save volume ranges as string ex: 3-4 | ||
for volume in volumes: | ||
numbering.append({'volume': volume}) | ||
if pages: | ||
numbering[-1]['pages'] = pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right : If original value is 2-5, 22
the result will be
{
"volume": 2, # as a int !
"volume": 3,
"volume": 4,
"volume": 5,
"pages": "22"
}
rerowep
force-pushed
the
wep-fix-dojson-loc-partof
branch
from
March 23, 2023 07:14
fb31b83
to
a099fc5
Compare
* Fixes partOf numbering creation in marc21tojson LOC dojson. * Improves code quality according to Sourcery proposals. Co-Authored-by: Peter Weber <[email protected]>
rerowep
force-pushed
the
wep-fix-dojson-loc-partof
branch
from
March 23, 2023 08:17
a099fc5
to
66f2fee
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
f: data
About data model, importation, transformation, exportation of data, specific for bibliographic data
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.