mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 17:40:35 +00:00
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)
|
author = update_from_mappings(author, data, mappings)
|
||||||
# TODO this is making some BOLD assumption
|
# TODO this is making some BOLD assumption
|
||||||
name = data['name']
|
name = data.get('name')
|
||||||
author.last_name = name.split(' ')[-1]
|
author.last_name = name.split(' ')[-1]
|
||||||
author.first_name = ' '.join(name.split(' ')[:-1])
|
author.first_name = ' '.join(name.split(' ')[:-1])
|
||||||
author.save()
|
author.save()
|
||||||
|
@ -204,8 +204,9 @@ def set_default_edition(work):
|
||||||
options,
|
options,
|
||||||
key=lambda e: e.published_date.year if e.published_date else None
|
key=lambda e: e.published_date.year if e.published_date else None
|
||||||
)
|
)
|
||||||
options[0].default = True
|
if len(options):
|
||||||
options[0].save()
|
options[0].default = True
|
||||||
|
options[0].save()
|
||||||
|
|
||||||
|
|
||||||
def get_description(description_blob):
|
def get_description(description_blob):
|
||||||
|
|
|
@ -167,6 +167,10 @@ def handle_import_books(user, items):
|
||||||
identifier=item.shelf,
|
identifier=item.shelf,
|
||||||
user=user
|
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(
|
_, created = models.ShelfBook.objects.get_or_create(
|
||||||
book=item.book, shelf=desired_shelf, added_by=user)
|
book=item.book, shelf=desired_shelf, added_by=user)
|
||||||
if created:
|
if created:
|
||||||
|
|
Loading…
Reference in a new issue