1
0
Fork 0

Merge branch 'main' into page-range

This commit is contained in:
Giebisch 2023-02-06 14:02:05 +01:00
commit 248eab22ed
22 changed files with 109 additions and 40 deletions

View file

@ -52,7 +52,7 @@ class AnnualGoal(BookWyrmModel):
user=self.user,
book__in=book_ids,
)
return {r.book.id: r.rating for r in reviews}
return {r.book_id: r.rating for r in reviews}
@property
def progress(self):

View file

@ -32,7 +32,7 @@ class ReadThrough(BookWyrmModel):
def save(self, *args, **kwargs):
"""update user active time"""
cache.delete(f"latest_read_through-{self.user.id}-{self.book.id}")
cache.delete(f"latest_read_through-{self.user_id}-{self.book_id}")
self.user.update_active_date()
# an active readthrough must have an unset finish date
if self.finish_date or self.stopped_date:

View file

@ -107,7 +107,7 @@ class ShelfBook(CollectionItemMixin, BookWyrmModel):
# remove all caches related to all editions of this book
cache.delete_many(
[
f"book-on-shelf-{book.id}-{self.shelf.id}"
f"book-on-shelf-{book.id}-{self.shelf_id}"
for book in self.book.parent_work.editions.all()
]
)
@ -117,7 +117,7 @@ class ShelfBook(CollectionItemMixin, BookWyrmModel):
if self.id and self.user.local:
cache.delete_many(
[
f"book-on-shelf-{book}-{self.shelf.id}"
f"book-on-shelf-{book}-{self.shelf_id}"
for book in self.book.parent_work.editions.values_list(
"id", flat=True
)

View file

@ -80,7 +80,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
def save(self, *args, **kwargs):
"""save and notify"""
if self.reply_parent:
self.thread_id = self.reply_parent.thread_id or self.reply_parent.id
self.thread_id = self.reply_parent.thread_id or self.reply_parent_id
super().save(*args, **kwargs)