From 4d17790cbecf67d429a1ff4338f06d24dfb4a022 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Sun, 15 Sep 2024 20:59:30 +0100 Subject: [PATCH] Main list orders by the main artist --- lib/music_library/records.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/music_library/records.ex b/lib/music_library/records.ex index 77f423f4..6e373d26 100644 --- a/lib/music_library/records.ex +++ b/lib/music_library/records.ex @@ -18,9 +18,12 @@ defmodule MusicLibrary.Records do """ def list_records do - Record - |> limit(10) - |> Repo.all() + q = + from r in Record, + order_by: r.artists[0]["sort_name"], + limit: 50 + + Repo.all(q) end @doc """