Skip to content

Commit

Permalink
deposits: fix swisscovery import
Browse files Browse the repository at this point in the history
* Fixes error on 502 fields on leader function.
* Fixes extract date on 100 or 700 field.
* Closes rero#674.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Peter Weber <peter.weber@rero.ch>
  • Loading branch information
Garfield-fr and rerowep committed Nov 4, 2021
1 parent dcd9574 commit 585b285
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sonar/modules/documents/dojson/sru/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ def marc21_to_contribution_from_100_700(self, key, value):
data = {'agent': {'type': type, 'preferred_name': name}, 'role': [role]}

if is_100_or_700 and value.get('d'):
date_of_birth, date_of_death = overdo.extract_date(value['d'][:9])
date_of_birth = date_of_death = None
try:
date_of_birth, date_of_death = overdo.extract_date(value['d'][:9])
except Exception:
pass

if date_of_birth:
data['agent']['date_of_birth'] = date_of_birth
Expand Down Expand Up @@ -539,8 +543,8 @@ def marc21_to_document_type_from_leader(self, key, value):
if leader_07 == 's':
return 'coar:c_2659'

field_502 = overdo.blob_record.get('502__')
if field_502:
fields_502 = overdo.blob_record.get('502__')
for field_502 in fields_502:
# Bachelor thesis
if 'bachelor' in field_502.get(
'a', '') or 'bachelor' in field_502.get('b', ''):
Expand Down

0 comments on commit 585b285

Please sign in to comment.