Make records ordering case insensitive

So that "iamthemorning" gets slotted in the right place
This commit is contained in:
Claudio Ortolina
2024-10-31 12:48:40 +00:00
parent ab3e5ef2ad
commit 9f2acc4e5d
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ defmodule MusicLibrary.Records do
base_search =
from r in Record,
where: not is_nil(r.purchased_at),
order_by: [r.artists[0]["sort_name"], r.title]
order_by:
fragment(
"json_extract(artists, '$[0].sort_name') COLLATE NOCASE ASC, title COLLATE NOCASE ASC"
)
Enum.reduce(parsed_query, base_search, fn
{:artist, artist}, search ->
+4 -1
View File
@@ -40,7 +40,10 @@ defmodule MusicLibrary.Wishlist do
base_search =
from r in Record,
where: is_nil(r.purchased_at),
order_by: [r.artists[0]["sort_name"], r.title]
order_by:
fragment(
"json_extract(artists, '$[0].sort_name') COLLATE NOCASE ASC, title COLLATE NOCASE ASC"
)
Enum.reduce(parsed_query, base_search, fn
{:artist, artist}, search ->