Show how many years ago for "On this day" records

This commit is contained in:
Claudio Ortolina
2025-08-29 13:09:27 +03:00
parent e54dcc50dc
commit 064ece03f3
7 changed files with 40 additions and 9 deletions
@@ -9,11 +9,12 @@ defmodule MusicLibraryWeb.StatsLive.Index do
alias MusicLibraryWeb.StatsLive.{TopAlbums, TopArtists}
def mount(_params, _session, socket) do
current_date = Date.utc_today()
latest_record = Collection.get_latest_record!()
recent_tracks = LastFm.get_scrobbled_tracks()
records_by_artists = Collection.count_records_by_artist(limit: 20)
records_by_genre = Collection.count_records_by_genre(limit: 20)
records_on_this_day = Collection.get_records_on_this_day()
records_on_this_day = Collection.get_records_on_this_day(current_date)
if connected?(socket) do
LastFm.subscribe_to_feed()
@@ -32,6 +33,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|> assign_counts()
|> assign_scrobble_activity(recent_tracks)
|> assign(
current_date: current_date,
scrobble_activity_mode: "albums",
latest_record: latest_record,
page_title: gettext("Stats"),
@@ -493,6 +493,7 @@
{gettext("On This day")}
</h1>
<.records_on_this_day
current_date={@current_date}
records={@streams.records_on_this_day}
record_show_path={fn record -> ~p"/collection/#{record}" end}
/>