Expand matching books on keys like isbn

This commit is contained in:
Mouse Reeve
2020-05-03 21:00:25 -07:00
parent 3c3afed6b3
commit 07aab3806b
4 changed files with 109 additions and 68 deletions

View File

@ -34,17 +34,20 @@ class Connector(AbstractConnector):
search_results = []
for book in results[:10]:
search_results.append(
SearchResult(
book.title,
book.id,
book.author_text,
book.published_date.year if book.published_date else None,
None
)
self.format_search_result(book)
)
return search_results
def format_search_result(self, book):
return SearchResult(
book.title,
book.id,
book.author_text,
book.published_date.year if book.published_date else None,
)
def get_or_create_book(self, book_id):
''' since this is querying its own data source, it can only
get a book, not load one from an external source '''