mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-09 07:14:52 +02:00
Fix:Size and duration sort
This commit is contained in:
@ -135,12 +135,18 @@ 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) {
|
||||
|
Reference in New Issue
Block a user