mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-18 00:29:06 +02: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
1 changed files with 2 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue