mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-08-26 21:34:12 +02:00
fix: series book count with active filters
This commit is contained in:
@@ -311,7 +311,7 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
async getCollapseSeriesBooksToExclude(bookFindOptions, seriesWhere, replacements = {}) {
|
async getCollapseSeriesBooksToExclude(bookFindOptions, seriesWhere, replacements = {}) {
|
||||||
const allSeries = await Database.seriesModel.findAll({
|
const allSeries = await Database.seriesModel.findAll({
|
||||||
attributes: ['id', 'name', [Sequelize.literal('(SELECT count(*) FROM bookSeries bs WHERE bs.seriesId = series.id)'), 'numBooks']],
|
attributes: ['id', 'name'],
|
||||||
distinct: true,
|
distinct: true,
|
||||||
subQuery: false,
|
subQuery: false,
|
||||||
replacements,
|
replacements,
|
||||||
@@ -339,7 +339,7 @@ module.exports = {
|
|||||||
booksToInclude.push(book.id)
|
booksToInclude.push(book.id)
|
||||||
bookSeriesToInclude.push({
|
bookSeriesToInclude.push({
|
||||||
id: book.bookSeries.id,
|
id: book.bookSeries.id,
|
||||||
numBooks: s.dataValues.numBooks,
|
numBooks: s.books.length,
|
||||||
libraryItemIds: s.books?.map((b) => b.libraryItem.id) || []
|
libraryItemIds: s.books?.map((b) => b.libraryItem.id) || []
|
||||||
})
|
})
|
||||||
booksToExclude = booksToExclude.filter((bid) => bid !== book.id)
|
booksToExclude = booksToExclude.filter((bid) => bid !== book.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user