mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Import ratings as ratings, not reviews
This commit is contained in:
parent
7449f34a61
commit
c2ffdb8f03
1 changed files with 27 additions and 18 deletions
|
@ -116,6 +116,10 @@ def handle_imported_book(source, user, item, include_reviews, privacy):
|
|||
read.save()
|
||||
|
||||
if include_reviews and (item.rating or item.review):
|
||||
# we don't know the publication date of the review,
|
||||
# but "now" is a bad guess
|
||||
published_date_guess = item.date_read or item.date_added
|
||||
if item.review:
|
||||
review_title = (
|
||||
"Review of {!r} on {!r}".format(
|
||||
item.book.title,
|
||||
|
@ -124,10 +128,6 @@ def handle_imported_book(source, user, item, include_reviews, privacy):
|
|||
if item.review
|
||||
else ""
|
||||
)
|
||||
|
||||
# we don't know the publication date of the review,
|
||||
# but "now" is a bad guess
|
||||
published_date_guess = item.date_read or item.date_added
|
||||
models.Review.objects.create(
|
||||
user=user,
|
||||
book=item.book,
|
||||
|
@ -137,3 +137,12 @@ def handle_imported_book(source, user, item, include_reviews, privacy):
|
|||
published_date=published_date_guess,
|
||||
privacy=privacy,
|
||||
)
|
||||
else:
|
||||
# just a rating
|
||||
models.ReviewRating.objects.create(
|
||||
user=user,
|
||||
book=item.book,
|
||||
rating=item.rating,
|
||||
published_date=published_date_guess,
|
||||
privacy=privacy,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue