Still shelve books in no-reviews import mode

This commit is contained in:
Mouse Reeve 2020-10-30 12:07:22 -07:00
parent 701be26100
commit 9780879ce6
2 changed files with 5 additions and 5 deletions

View file

@ -47,9 +47,9 @@ def import_data(job_id):
item.save() item.save()
results.append(item) results.append(item)
if job.include_reviews: # shelves book and handles reviews
# shelves book and handles reviews outgoing.handle_imported_book(
outgoing.handle_imported_book(job.user, item, job.privacy) job.user, item, job.include_reviews, job.privacy)
else: else:
item.fail_reason = "Could not find a match for book" item.fail_reason = "Could not find a match for book"
item.save() item.save()

View file

@ -155,7 +155,7 @@ def handle_unshelve(user, book, shelf):
broadcast(user, activity) broadcast(user, activity)
def handle_imported_book(user, item, privacy): def handle_imported_book(user, item, include_reviews, privacy):
''' process a goodreads csv and then post about it ''' ''' process a goodreads csv and then post about it '''
if isinstance(item.book, models.Work): if isinstance(item.book, models.Work):
item.book = item.book.default_edition item.book = item.book.default_edition
@ -179,7 +179,7 @@ def handle_imported_book(user, item, privacy):
read.user = user read.user = user
read.save() read.save()
if item.rating or item.review: if include_reviews and (item.rating or item.review):
review_title = 'Review of {!r} on Goodreads'.format( review_title = 'Review of {!r} on Goodreads'.format(
item.book.title, item.book.title,
) if item.review else '' ) if item.review else ''