From 52a268851a2d3665ae44d3bae82643764691810f Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 22 Oct 2024 18:27:44 +0100 Subject: [PATCH] Fix stats queries not to include wishlist --- lib/music_library/records.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/music_library/records.ex b/lib/music_library/records.ex index aef39926..b2a08c51 100644 --- a/lib/music_library/records.ex +++ b/lib/music_library/records.ex @@ -80,6 +80,7 @@ defmodule MusicLibrary.Records do def count_records_by_format do q = from r in Record, + where: not is_nil(r.purchased_at), group_by: r.format, select: {r.format, count(r.id)} @@ -89,6 +90,7 @@ defmodule MusicLibrary.Records do def count_records_by_type do q = from r in Record, + where: not is_nil(r.purchased_at), group_by: r.type, select: {r.type, count(r.id)} @@ -100,6 +102,7 @@ defmodule MusicLibrary.Records do def get_latest_record! do q = from r in Record, + where: not is_nil(r.purchased_at), order_by: [desc: r.purchased_at], limit: 1, select: ^@fields