mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-01 00:18:14 +01:00
Update:Author number of books sort fallsback to sort on name when num books is the same
This commit is contained in:
parent
98cd19d440
commit
064679c057
@ -61,6 +61,8 @@ export default {
|
|||||||
const bDesc = this.authorSortDesc ? -1 : 1
|
const bDesc = this.authorSortDesc ? -1 : 1
|
||||||
return this.authors.sort((a, b) => {
|
return this.authors.sort((a, b) => {
|
||||||
if (typeof a[sortProp] === 'number' && typeof b[sortProp] === 'number') {
|
if (typeof a[sortProp] === 'number' && typeof b[sortProp] === 'number') {
|
||||||
|
// Fallback to name sort if equal
|
||||||
|
if (a[sortProp] === b[sortProp]) return a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }) * bDesc
|
||||||
return a[sortProp] > b[sortProp] ? bDesc : -bDesc
|
return a[sortProp] > b[sortProp] ? bDesc : -bDesc
|
||||||
}
|
}
|
||||||
return a[sortProp]?.localeCompare(b[sortProp], undefined, { sensitivity: 'base' }) * bDesc
|
return a[sortProp]?.localeCompare(b[sortProp], undefined, { sensitivity: 'base' }) * bDesc
|
||||||
|
Loading…
Reference in New Issue
Block a user