mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-17 00:08:55 +01:00
Fix and simplify filter logic for publishedDecades
This commit is contained in:
parent
13dd4edd6a
commit
217038b085
@ -229,9 +229,10 @@ module.exports = {
|
|||||||
mediaWhere['$series.id$'] = null
|
mediaWhere['$series.id$'] = null
|
||||||
}
|
}
|
||||||
} else if (group === 'publishedDecades') {
|
} else if (group === 'publishedDecades') {
|
||||||
const year = parseInt(value, 10)
|
const startYear = value.padStart(4, '0')
|
||||||
|
const endYear = (parseInt(value, 10) + 9).toString().padStart(4, '0')
|
||||||
mediaWhere['publishedYear'] = {
|
mediaWhere['publishedYear'] = {
|
||||||
[Sequelize.Op.between]: year >= 1000 ? [year, year + 9] : [year * 10, (year + 1) * 10 - 1]
|
[Sequelize.Op.between]: [startYear, endYear]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user