Rename record to latest record in stats

This commit is contained in:
Claudio Ortolina
2024-10-02 21:27:38 +01:00
parent 62d792a244
commit a02e6a5fcf
2 changed files with 6 additions and 6 deletions
@@ -6,12 +6,12 @@ defmodule MusicLibraryWeb.StatsController do
def index(conn, _params) do def index(conn, _params) do
records_count_by_format = Records.count_records_by_format() records_count_by_format = Records.count_records_by_format()
records_count = Enum.reduce(records_count_by_format, 0, fn {_, count}, acc -> acc + count end) records_count = Enum.reduce(records_count_by_format, 0, fn {_, count}, acc -> acc + count end)
record = Records.get_latest_record!() latest_record = Records.get_latest_record!()
render(conn, :index, render(conn, :index,
records_count_by_format: records_count_by_format, records_count_by_format: records_count_by_format,
records_count: records_count, records_count: records_count,
record: record, latest_record: latest_record,
nav_section: :dashboard nav_section: :dashboard
) )
end end
@@ -40,17 +40,17 @@
<dt> <dt>
<img <img
class="absolute max-w-12 rounded-lg shadow" class="absolute max-w-12 rounded-lg shadow"
src={~p"/images/#{@record.id}"} src={~p"/images/#{@latest_record.id}"}
alt={@record.title} alt={@latest_record.title}
/> />
<p class="ml-16 truncate text-sm font-medium text-gray-500">Latest record</p> <p class="ml-16 truncate text-sm font-medium text-gray-500">Latest record</p>
</dt> </dt>
<dd class="ml-16 flex items-baseline pb-6 sm:pb-7"> <dd class="ml-16 flex items-baseline pb-6 sm:pb-7">
<p class="text-2xl font-semibold text-gray-900"><%= @record.title %></p> <p class="text-2xl font-semibold text-gray-900"><%= @latest_record.title %></p>
<div class="absolute inset-x-0 bottom-0 bg-gray-50 px-4 py-4 sm:px-6"> <div class="absolute inset-x-0 bottom-0 bg-gray-50 px-4 py-4 sm:px-6">
<div class="text-sm"> <div class="text-sm">
<a <a
href={~p"/records/#{@record.id}"} href={~p"/records/#{@latest_record.id}"}
class="font-medium text-zinc-600 hover:text-zinc-500" class="font-medium text-zinc-600 hover:text-zinc-500"
> >
View<span class="sr-only"> record</span> View<span class="sr-only"> record</span>