forked from mirrors/bookwyrm
Fixes for goodreads import + ol changes
This commit is contained in:
parent
ca26a712c3
commit
0a8d080b62
2 changed files with 8 additions and 3 deletions
|
@ -167,7 +167,7 @@ class Connector(AbstractConnector):
|
|||
}
|
||||
author = update_from_mappings(author, data, mappings)
|
||||
# TODO this is making some BOLD assumption
|
||||
name = data['name']
|
||||
name = data.get('name')
|
||||
author.last_name = name.split(' ')[-1]
|
||||
author.first_name = ' '.join(name.split(' ')[:-1])
|
||||
author.save()
|
||||
|
@ -204,6 +204,7 @@ def set_default_edition(work):
|
|||
options,
|
||||
key=lambda e: e.published_date.year if e.published_date else None
|
||||
)
|
||||
if len(options):
|
||||
options[0].default = True
|
||||
options[0].save()
|
||||
|
||||
|
|
|
@ -167,6 +167,10 @@ def handle_import_books(user, items):
|
|||
identifier=item.shelf,
|
||||
user=user
|
||||
)
|
||||
if isinstance(item.book, models.Work):
|
||||
item.book = item.book.default_edition
|
||||
if not item.book:
|
||||
continue
|
||||
_, created = models.ShelfBook.objects.get_or_create(
|
||||
book=item.book, shelf=desired_shelf, added_by=user)
|
||||
if created:
|
||||
|
|
Loading…
Reference in a new issue