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

dojson: fix LOC partOf numbering #3282

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

rerowep
Copy link
Contributor

@rerowep rerowep commented Mar 14, 2023

  • Fixes partOf numbering creation in unimarc dojson.
  • Improves code quality according to Sourcery proposals.

@rerowep rerowep self-assigned this Mar 14, 2023
@github-actions github-actions bot added the f: data About data model, importation, transformation, exportation of data, specific for bibliographic data label Mar 14, 2023
@rerowep rerowep force-pushed the wep-fix-dojson-loc-partof branch 8 times, most recently from 472f71f to fb31b83 Compare March 21, 2023 16:03
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
Copy link
Contributor

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 rerowep force-pushed the wep-fix-dojson-loc-partof branch from fb31b83 to a099fc5 Compare March 23, 2023 07:14
* Fixes partOf numbering creation in marc21tojson LOC dojson.
* Improves code quality according to Sourcery proposals.

Co-Authored-by: Peter Weber <[email protected]>
@rerowep rerowep force-pushed the wep-fix-dojson-loc-partof branch from a099fc5 to 66f2fee Compare March 23, 2023 08:17
@rerowep rerowep merged commit d62bed7 into rero:staging Mar 29, 2023
@rerowep rerowep deleted the wep-fix-dojson-loc-partof branch May 2, 2023 09:42
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants