mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 03:30:37 +02:00
Fix:Bookshelf shadow,Fix:Series volume sort
This commit is contained in:
parent
9423727f89
commit
0c1a0f5d01
5 changed files with 12 additions and 15 deletions
|
@ -135,18 +135,12 @@ class LibraryController {
|
|||
if (payload.sortBy) {
|
||||
var orderByNumber = payload.sortBy === 'book.volumeNumber'
|
||||
var direction = payload.sortDesc ? 'desc' : 'asc'
|
||||
// if (req.query.sort === 'size') {
|
||||
// console.warn('1SORTING BY SIZE', audiobooks[0])
|
||||
// }
|
||||
audiobooks = sort(audiobooks)[direction]((ab) => {
|
||||
// Supports dot notation strings i.e. "book.title"
|
||||
var value = payload.sortBy.split('.').reduce((a, b) => a[b], ab)
|
||||
if (orderByNumber && !isNaN(value)) return Number(value)
|
||||
return value
|
||||
})
|
||||
// if (req.query.sort === 'size') {
|
||||
// console.warn('2SORTING BY SIZE', audiobooks[0])
|
||||
// }
|
||||
}
|
||||
|
||||
if (payload.limit) {
|
||||
|
@ -194,6 +188,7 @@ class LibraryController {
|
|||
return res.status(404).send('Series not found')
|
||||
}
|
||||
audiobooks = sort(audiobooks).asc(ab => {
|
||||
if (!isNaN(ab.book.volumeNumber) && ab.book.volumeNumber !== null) return Number(ab.book.volumeNumber)
|
||||
return ab.book.volumeNumber
|
||||
})
|
||||
res.json({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue