Skip to content

Commit

Permalink
get current book only returns books with a published date
Browse files Browse the repository at this point in the history
  • Loading branch information
Moggach committed Jul 16, 2024
1 parent 4c62cff commit 5d4a4b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/utils/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def get_current_book(book_types: Union[None, str, List[str]]):

if len(book_types) > 0 and "all-books" not in book_types:
return (
BookPage.objects.filter(type__in=book_types)
BookPage.objects.filter(type__in=book_types, published_date__isnull=False)
.order_by("-published_date")
.first()
)
return BookPage.objects.order_by("-published_date").first()
return BookPage.objects.filter(published_date__isnull=False).order_by("-published_date").first()

0 comments on commit 5d4a4b5

Please sign in to comment.