Skip to content

Commit

Permalink
documents: fix partOf format
Browse files Browse the repository at this point in the history
* Displays the issue and pages even if volume is not set.
* Closes #370.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Aug 17, 2021
1 parent 9b8338b commit 96371c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions sonar/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ def part_of_format(part_of):
items.append('{label} {value}'.format(
label=_('vol.'), value=part_of['numberingVolume']))

if 'numberingIssue' in part_of:
items.append('{label} {value}'.format(
label=_('no.'), value=part_of['numberingIssue']))
if 'numberingIssue' in part_of:
items.append('{label} {value}'.format(
label=_('no.'), value=part_of['numberingIssue']))

if 'numberingPages' in part_of:
items.append('{label} {value}'.format(
label=_('p.'), value=part_of['numberingPages']))
if 'numberingPages' in part_of:
items.append('{label} {value}'.format(
label=_('p.'), value=part_of['numberingPages']))

return ', '.join(items)

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/documents/test_dc_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def test_sources(minimal_document):
assert result['sources'] == [
'Document 1, 2020',
'Document 2, 2020, vol. 6, no. 12, p. 135-139',
'Document 3, 2019',
'Document 3, 2019, no. 12, p. 135-139',
]


Expand Down
2 changes: 1 addition & 1 deletion tests/ui/documents/test_documents_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_part_of_format():
'numberingYear': '2015',
'numberingIssue': '2',
'numberingPages': '469-480'
}) == 'Mehr oder weniger Staat?, 2015'
}) == 'Mehr oder weniger Staat?, 2015, no. 2, p. 469-480'

assert views.part_of_format({
'numberingYear': '2015',
Expand Down

0 comments on commit 96371c3

Please sign in to comment.