Remove unused functions

This commit is contained in:
Claudio Ortolina
2025-09-26 15:21:09 +03:00
parent aca5c80e4d
commit cc84c3a429
5 changed files with 0 additions and 45 deletions
-2
View File
@@ -2,8 +2,6 @@ defmodule LastFm do
alias LastFm.{API, Feed, Refresh, Scrobble, Track, Worker}
alias MusicLibrary.{BackgroundRepo, Repo}
def get_scrobbled_tracks(limit \\ 100), do: Feed.all_tracks(limit)
def subscribe_to_feed, do: Feed.subscribe()
def refresh_scrobbled_tracks, do: Refresh.refresh()
-12
View File
@@ -8,8 +8,6 @@ defmodule LastFm.Feed do
to one track at a time, and the timestamp has second-level precision.
"""
import Ecto.Query
@insertable_fields [
:musicbrainz_id,
:title,
@@ -44,16 +42,6 @@ defmodule LastFm.Feed do
{:ok, count}
end
@spec all_tracks(non_neg_integer()) :: [LastFm.Track.t()]
def all_tracks(limit) do
q =
from t in LastFm.Track,
order_by: {:desc, t.scrobbled_at_uts},
limit: ^limit
MusicLibrary.Repo.all(q)
end
@spec subscribe() :: :ok
def subscribe do
Phoenix.PubSub.subscribe(LastFm.PubSub, "feed:update")
-10
View File
@@ -75,16 +75,6 @@ defmodule MusicLibrary.Collection do
Repo.one!(q)
end
def collected_releases(release_ids) do
q =
from r in fragment("records, json_each(records.release_ids)"),
where: r.value in ^release_ids,
where: fragment("records.purchased_at IS NOT NULL"),
select: %{record_id: fragment("records.id"), release_id: r.value}
Repo.all(q)
end
def count_records_by_artist(opts \\ []) do
limit = Keyword.get(opts, :limit, 30)
-10
View File
@@ -21,16 +21,6 @@ defmodule MusicLibrary.Wishlist do
Repo.aggregate(base_search(), :count)
end
def wishlisted_releases(release_ids) do
q =
from r in fragment("records, json_each(records.release_ids)"),
where: r.value in ^release_ids,
where: fragment("records.purchased_at IS NULL"),
select: %{record_id: fragment("records.id"), release_id: r.value}
Repo.all(q)
end
defp base_search do
from r in SearchIndex,
where: is_nil(r.purchased_at)
-11
View File
@@ -47,16 +47,5 @@ defmodule LastFm.FeedTest do
assert {:ok, 0} == Feed.update([@track_two, @track_one])
assert_receive %{track_count: 0}
end
test "it returns tracks in descending order of scrobble" do
assert {:ok, 2} == Feed.update([@track_two, @track_one])
track_two_scrobbled_at_uts = @track_two.scrobbled_at_uts
track_one_scrobbled_at_uts = @track_one.scrobbled_at_uts
assert [
%{scrobbled_at_uts: ^track_two_scrobbled_at_uts},
%{scrobbled_at_uts: ^track_one_scrobbled_at_uts}
] = Feed.all_tracks(10)
end
end
end