Improve top albums

Makes it timezone aware, so that it can round up to the beginning of day
This commit is contained in:
Claudio Ortolina
2025-06-15 12:12:04 +03:00
parent 389c268344
commit 753615c57f
2 changed files with 28 additions and 9 deletions
@@ -287,7 +287,15 @@ defmodule MusicLibraryWeb.StatsLive.Index do
end
defp assign_top_albums(socket) do
top_albums = ScrobbleActivity.get_top_albums_by_periods(10)
timezone = socket.assigns.timezone
current_time = DateTime.utc_now()
top_albums =
ScrobbleActivity.get_top_albums_by_periods(
limit: 10,
current_time: current_time,
timezone: timezone
)
assign(socket, top_albums: top_albums)
end