Show record count by format in stats dashboard

This commit is contained in:
Claudio Ortolina
2024-10-02 21:26:21 +01:00
parent 6edbb7e057
commit 62d792a244
4 changed files with 28 additions and 2 deletions
+9
View File
@@ -39,6 +39,15 @@ defmodule MusicLibrary.Records do
Repo.aggregate(Record, :count)
end
def count_records_by_format do
q =
from r in Record,
group_by: r.format,
select: {r.format, count(r.id)}
Repo.all(q)
end
def search_records_count(query) do
q =
from r in Record,