1
0
Fork 0

Slice queryset before we resolve it

This was accidentally querying ALL books in the database to generate
suggestions if we didn't have enough, which broke some stuff
This commit is contained in:
Joel Bradshaw 2022-11-23 19:26:09 +00:00
commit 55bab0b70d

View file

@ -110,8 +110,8 @@ def get_list_suggestions(book_list, user, query=None):
s.default_edition
for s in models.Work.objects.filter(
~Q(editions__in=book_list.books.all()),
).order_by("-updated_date")
][: 5 - len(suggestions)]
).order_by("-updated_date")[: 5 - len(suggestions)]
]
return suggestions