Skip to content

Commit

Permalink
Avoids pylint complaints
Browse files Browse the repository at this point in the history
That said, really pylint is making the valid point that this function is
too complex and I'm not actually making it less complex by doing this,
but I really want that green dot on the CLI
  • Loading branch information
mouse-reeve committed Aug 27, 2024
1 parent 33569f3 commit cd7a6a0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bookwyrm/views/books/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,17 @@ def get(self, request, book_id, **kwargs):
"quotation_count": book.quotation_set.filter(**filters).count(),
}
if hasattr(book.parent_work, "suggestion_list"):
suggestion_list = book.parent_work.suggestion_list
data["suggestion_list"] = suggestion_list
data["suggestion_list"] = book.parent_work.suggestion_list
data["items"] = (
suggestion_list.suggestionlistitem_set.prefetch_related(
data["suggestion_list"].suggestionlistitem_set.prefetch_related(
"user", "book", "book__authors", "endorsement"
)
.annotate(endorsement_count=Count("endorsement"))
.order_by("-endorsement_count")[:3]
)

data["suggested_books"] = get_list_suggestions(
suggestion_list,
data["suggestion_list"],
request.user,
query=request.GET.get("suggestion_query", ""),
ignore_book=book.parent_work,
Expand Down

0 comments on commit cd7a6a0

Please sign in to comment.