Fixed issue where querying empty collection returns an empty book record
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user