Skip to content

Commit

Permalink
import: fix SUDOC authors facette
Browse files Browse the repository at this point in the history
* Adds `_text` for SUDOC contribubtion with $ref.

Co-Authored-by: Peter Weber <peter.weber@rero.ch>
  • Loading branch information
rerowep committed Dec 13, 2023
1 parent 85c6766 commit bb94385
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,10 @@ def unimarc_to_contribution(self, key, value):
key=key
)):
return {
'entity': {'$ref': ref},
'entity': {
'$ref': ref,
'_text': create_authorized_access_point(agent)
},
'role': roles
}
else:
Expand Down
15 changes: 10 additions & 5 deletions rero_ils/modules/imports/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
from requests.exceptions import Timeout
from six import BytesIO

from ..documents.dojson.contrib.marc21tojson import marc21_dnb, marc21_kul, \
marc21_loc, marc21_slsp, marc21_ugent
from ..documents.dojson.contrib.unimarctojson import unimarc
from rero_ils.modules.documents.dojson.contrib.marc21tojson import \
marc21_dnb, marc21_kul, marc21_loc, marc21_slsp, marc21_ugent
from rero_ils.modules.documents.dojson.contrib.unimarctojson import unimarc


class Import(object):
Expand Down Expand Up @@ -180,8 +180,13 @@ def calculate_aggregations(self, record, id):

contribution = record.get('contribution', [])
for agent in contribution:
name = agent.get('entity', {}).get('authorized_access_point')
self.calculate_aggregations_add('author', name, id)
if authorized_access_point := agent.get(
'entity', {}).get('authorized_access_point'):
name = authorized_access_point
elif text := agent.get('entity', {}).get('_text'):
name = text
if name:
self.calculate_aggregations_add('author', name, id)

languages = record.get('language', [])
for language in languages:
Expand Down

0 comments on commit bb94385

Please sign in to comment.