Fixed issue where querying empty collection returns an empty book record

This commit is contained in:
2026-04-06 21:08:32 +02:00
parent 2552ba8e94
commit a537c12a3b
5 changed files with 31 additions and 11 deletions

View File

@@ -226,7 +226,7 @@ func FetchCollectionBooks(db *gorm.DB, collectionId uint, limit int, offset int)
func FetchCollectionBooksCount(db *gorm.DB, collectionId uint) (int64, error) {
var count int64
res := fetchCollectionBooksQuery(db, collectionId).Count(&count)
res := fetchCollectionBooksQuery(db, collectionId).Where("book_id IS NOT NULL").Count(&count)
return count, res.Error
}