- # WTF: was outside if, overwriting value assigned if shelf_is_set
- related_book_tags = get_top_level_related_tags(tags)
+ related_book_tags = Tag.objects.usage_for_queryset(
+ objects, counts=True).exclude(
+ category='set').exclude(pk__in=tags_pks)
+ else:
+ if tags:
+ objects = Book.tagged_top_level(tags)
+ else:
+ objects = all_books
+ related_book_tags = get_top_level_related_tags(tags)