Merge branch 'main' into admin-manually-activate-user

This commit is contained in:
Dustin 2023-01-29 11:21:31 +00:00 committed by GitHub
commit c0e541c7ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 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)

View file

@ -6,16 +6,16 @@
@use 'bulma/bulma.sass';
.shepherd-button {
@extend .button.mr-2;
@extend .button, .mr-2;
}
.shepherd-button.shepherd-button-secondary {
@extend .button.is-light;
@extend .button, .is-light;
}
.shepherd-footer {
@extend .message-body;
@extend .is-info.is-light;
@extend .is-info, .is-light;
border-color: $info-light;
border-radius: 0 0 4px 4px;
}
@ -29,7 +29,7 @@
.shepherd-text {
@extend .message-body;
@extend .is-info.is-light;
@extend .is-info, .is-light;
border-radius: 0;
}

View file

@ -68,7 +68,7 @@ class AnnualSummary(View):
book_list_by_pages = read_books_in_year.filter(pages__gte=0).order_by("pages")
# books with no pages
no_page_list = len(read_books_in_year.filter(pages__exact=None))
no_page_list = read_books_in_year.filter(pages__exact=None).count()
# rating stats queries
ratings = (
@ -95,13 +95,13 @@ class AnnualSummary(View):
"book_pages_lowest": book_list_by_pages.first(),
"book_pages_highest": book_list_by_pages.last(),
"no_page_number": no_page_list,
"ratings_total": len(ratings),
"ratings_total": ratings.count(),
"rating_average": round(
ratings_stats["rating__avg"] if ratings_stats["rating__avg"] else 0, 2
),
"book_rating_highest": ratings.order_by("-rating").first(),
"best_ratings_books_ids": [
review.book.id for review in ratings.filter(rating=5)
review.book_id for review in ratings.filter(rating=5)
],
"paginated_years": paginated_years,
"goal_status": goal_status,