mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 09:51:37 +00:00
fix: series book count with active filters
This commit is contained in:
parent
4502d37d4f
commit
c4e7172c2f
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue