Make records ordering case insensitive
So that "iamthemorning" gets slotted in the right place
This commit is contained in:
@@ -32,7 +32,10 @@ defmodule MusicLibrary.Records do
|
|||||||
base_search =
|
base_search =
|
||||||
from r in Record,
|
from r in Record,
|
||||||
where: not is_nil(r.purchased_at),
|
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
|
Enum.reduce(parsed_query, base_search, fn
|
||||||
{:artist, artist}, search ->
|
{:artist, artist}, search ->
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ defmodule MusicLibrary.Wishlist do
|
|||||||
base_search =
|
base_search =
|
||||||
from r in Record,
|
from r in Record,
|
||||||
where: is_nil(r.purchased_at),
|
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
|
Enum.reduce(parsed_query, base_search, fn
|
||||||
{:artist, artist}, search ->
|
{:artist, artist}, search ->
|
||||||
|
|||||||
Reference in New Issue
Block a user