forked from mirrors/bookwyrm
Merge pull request #414 from mouse-reeve/openlibrary-covers
Fixes openlibrary import to prefer editions with covers
This commit is contained in:
commit
bcb972ddf7
3 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue