advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.28k stars 441 forks source link

[Bug]: authors.lastFirst is not always populated #3447

Open pwinnski opened 2 hours ago

pwinnski commented 2 hours ago

What happened?

Of the 1961 authors in my library, 194 of them do not have a lastFirst set in the database, and so sort oddly.

sqlite> SELECT COUNT(*) FROM authors WHERE lastFirst IS NULL;
194
sqlite> SELECT COUNT(*) FROM authors WHERE lastFirst IS NOT NULL;
1767

I have no idea what sets these authors apart from others although just now as I was planning to copy and paste in some examples to show that they range from L. M. Montgomery to to Andrew Child, I noticed that one was clearly a failed QuickMatch, so I manually cleared out the metadata--and suddenly it had a lastFirst field set. So maybe these are the result of failures when I told it to "Match All Authors" with nearly 2000 authors?

Here's an example of three authors whose first names start with B sorting into the wrong place when sorting by Last, First: image It clearly shouldn't be that order and in fact, although I was mostly interesting in missing lastFirst columns, now I'm puzzled about why Asako Uzuki is out of order as well!

sqlite> SELECT name, lastFirst FROM authors WHERE name in ('Ben Wolf', 'Bryan Washington', 'Asako Yuzuki', 'Brianna Wiest', 'Bonnie Wynne', 'Brent Weinbach', 'C Pam Zhang', 'Bernice McFadden', 'Brené Brown') ORDER BY lastFirst;
Brent Weinbach|
Bernice McFadden|
Brené Brown|
Bryan Washington|Washington, Bryan
Brianna Wiest|Wiest, Brianna
Ben Wolf|Wolf, Ben
Bonnie Wynne|Wynne, Bonnie
Asako Yuzuki|Yuzuki, Asako
C Pam Zhang|Zhang, C Pam

Even ignoring the missing lastFirst authors, I still expect: Washington, Wiest, Wolf, Wynne, Yuzuki, Zhang, but I got: Washington, Wolf, Yuzuki, Wiest, Wynne, Zhang.

I just checked from my phone, and the sort order is different there! IMG_7075 Is that just ignoring "Last, First" and sorting by first name?

What did you expect to happen?

I expect all authors to have a lastFirst set, and for a list of authors sorted by Last, First to sort the authors by Last, First.

Steps to reproduce the issue

  1. Have my library?
  2. Visit the Authors tab, sorted by Last, First.

Audiobookshelf version

v2.13.4

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Other (list in "Additional Notes" box)

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Other (list in "Additional Notes" box)

Logs

No response

Additional Notes

Hosted on Synology via Docker. I've tested on Arc (Chrome) desktop and iOS browser. Results are different, but both are wrong.

nichwall commented 2 hours ago

Duplicate of https://github.com/advplyr/audiobookshelf/issues/2385

pwinnski commented 1 hour ago

I note that there was a related fix in v2.13.2, for the lastFirst part of this. I will manually update the 193 remaining affected authors to get lastFirst updated everywhere, and hope that resolves the sorting issues as well. I'll update this issue with my results.