Fixes name import in openlibrary

This commit is contained in:
Mouse Reeve 2020-12-12 09:43:07 -08:00
parent a176c6cd35
commit 5cf9e24ae5

View file

@ -65,6 +65,7 @@ class Connector(AbstractConnector):
]
self.author_mappings = [
Mapping('name'),
Mapping('born', remote_field='birth_date', formatter=get_date),
Mapping('died', remote_field='death_date', formatter=get_date),
Mapping('bio', formatter=get_description),
@ -185,11 +186,6 @@ class Connector(AbstractConnector):
author = models.Author(openlibrary_key=olkey)
author = update_from_mappings(author, data, self.author_mappings)
name = data.get('name')
# TODO this is making some BOLD assumption
if name:
author.last_name = name.split(' ')[-1]
author.first_name = ' '.join(name.split(' ')[:-1])
author.save()
return author