Add refresh/0 to ListeningStats
This commit is contained in:
@@ -10,7 +10,16 @@ defmodule MusicLibrary.ListeningStats do
|
|||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
alias LastFm.Track
|
alias LastFm.Track
|
||||||
alias MusicLibrary.{Artists, Collection, Records.ArtistRecord, Records.Record, Repo, Wishlist}
|
|
||||||
|
alias MusicLibrary.{
|
||||||
|
Artists,
|
||||||
|
Collection,
|
||||||
|
ListeningStats.Refresh,
|
||||||
|
Records.ArtistRecord,
|
||||||
|
Records.Record,
|
||||||
|
Repo,
|
||||||
|
Wishlist
|
||||||
|
}
|
||||||
|
|
||||||
@pagination Application.compile_env!(:music_library, :pagination)
|
@pagination Application.compile_env!(:music_library, :pagination)
|
||||||
|
|
||||||
@@ -65,6 +74,11 @@ defmodule MusicLibrary.ListeningStats do
|
|||||||
Phoenix.PubSub.subscribe(MusicLibrary.PubSub, "listening_stats:update")
|
Phoenix.PubSub.subscribe(MusicLibrary.PubSub, "listening_stats:update")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec refresh() :: :ok | {:error, term()}
|
||||||
|
def refresh do
|
||||||
|
Refresh.refresh()
|
||||||
|
end
|
||||||
|
|
||||||
@spec artist_play_count(String.t()) :: non_neg_integer()
|
@spec artist_play_count(String.t()) :: non_neg_integer()
|
||||||
def artist_play_count(artist_musicbrainz_id) do
|
def artist_play_count(artist_musicbrainz_id) do
|
||||||
from(t in Track,
|
from(t in Track,
|
||||||
|
|||||||
Reference in New Issue
Block a user