Merge pull request #414 from mouse-reeve/openlibrary-covers

Fixes openlibrary import to prefer editions with covers
This commit is contained in:
Mouse Reeve 2020-12-21 12:45:09 -08:00 committed by GitHub
commit bcb972ddf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -140,7 +140,7 @@ class AbstractConnector(AbstractMinimalConnector):
for author in self.get_authors_from_data(edition_data):
edition.authors.add(author)
if not edition.authors.exists() and work.authors.exists():
edition.authors.add(work.authors.all())
edition.authors.set(work.authors.all())
return edition

View file

@ -174,7 +174,7 @@ def pick_default_edition(options):
if len(options) == 1:
return options[0]
options = [e for e in options if e.get('cover')] or options
options = [e for e in options if e.get('covers')] or options
options = [e for e in options if \
'/languages/eng' in str(e.get('languages'))] or options
formats = ['paperback', 'hardcover', 'mass market paperback']

View file

@ -44,7 +44,7 @@ class Openlibrary(TestCase):
def test_pick_default_edition(self):
edition = pick_default_edition(self.edition_list_data['entries'])
self.assertEqual(edition['key'], '/books/OL9952943M')
self.assertEqual(edition['key'], '/books/OL9788823M')
def test_format_search_result(self):