chronicle icon indicating copy to clipboard operation
chronicle copied to clipboard

Handling numbers in titles when sorting

Open mattttvaughn opened this issue 3 years ago • 1 comments

In the library view, books ought to be sorted like the following (numbers sorted by number order):

 - Series Name - Book 1 - Title
 - Series Name - Book 2 - Title
 - Series Name - Book 3 - Title
...
 - Series Name - Book 10 - Title
 - Series Name - Book 11 - Title

They are currently sorted like so:

 - Series Name - Book 1 - Title
 - Series Name - Book 10 - Title
 - Series Name - Book 11 - Title
...
 - Series Name - Book 19 - Title
 - Series Name - Book 2 - Title
 - Series Name - Book 20 - Title
 - Series Name - Book 21 - Title

This can be remedied by sorting by "natural order" instead of of by default string order. Natural sort in kotlin:

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.comparisons/natural-order.html

As of writing this ticket, sorting currently happens in LibraryViewModel

mattttvaughn avatar Dec 15 '21 01:12 mattttvaughn

Original report on the reddit: https://www.reddit.com/r/ChronicleApp/comments/rgahts/not_properly_sorting_books_by_title/

mattttvaughn avatar Dec 15 '21 01:12 mattttvaughn