From 8e654fb78285efc37b38c9de8e53d964c9c04b7b Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 22 Oct 2024 18:14:15 +0100 Subject: [PATCH] Rename counts in stats --- .../controllers/stats_controller.ex | 14 +++++++----- .../controllers/stats_html/index.html.heex | 12 +++++----- priv/gettext/default.pot | 22 +++++++++---------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/music_library_web/controllers/stats_controller.ex b/lib/music_library_web/controllers/stats_controller.ex index 1c9bbc90..28459a98 100644 --- a/lib/music_library_web/controllers/stats_controller.ex +++ b/lib/music_library_web/controllers/stats_controller.ex @@ -4,23 +4,25 @@ defmodule MusicLibraryWeb.StatsController do alias MusicLibrary.Records def index(conn, _params) do - records_count_by_format = + collection_count_by_format = Records.count_records_by_format() |> Enum.sort_by(fn {_format, count} -> count end, :desc) - records_count_by_type = + collection_count_by_type = Records.count_records_by_type() |> Enum.sort_by(fn {_type, count} -> count end, :desc) - records_count = Enum.reduce(records_count_by_format, 0, fn {_, count}, acc -> acc + count end) + collection_count = + Enum.reduce(collection_count_by_format, 0, fn {_, count}, acc -> acc + count end) + latest_record = Records.get_latest_record!() conn |> assign(:page_title, gettext("Stats")) |> render(:index, - records_count_by_format: records_count_by_format, - records_count_by_type: records_count_by_type, - records_count: records_count, + collection_count_by_format: collection_count_by_format, + collection_count_by_type: collection_count_by_type, + collection_count: collection_count, latest_record: latest_record, nav_section: :stats ) diff --git a/lib/music_library_web/controllers/stats_html/index.html.heex b/lib/music_library_web/controllers/stats_html/index.html.heex index abf0254c..cb1b48a5 100644 --- a/lib/music_library_web/controllers/stats_html/index.html.heex +++ b/lib/music_library_web/controllers/stats_html/index.html.heex @@ -11,7 +11,7 @@ alt={@latest_record.title} />

- <%= gettext("Latest record") %> + <%= gettext("Latest purchase") %>

@@ -31,11 +31,13 @@
-

<%= gettext("Total Records") %>

+

+ <%= gettext("Total collection") %> +

- <%= @records_count %> + <%= @collection_count %>
@@ -44,7 +46,7 @@
-
+
<%= Record.format_long_label(format) %>
@@ -61,7 +63,7 @@
-
+
<%= Record.type_long_label(type) %>
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 63cd3dd5..548162f9 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -84,7 +84,7 @@ msgid "Logout" msgstr "" #: lib/music_library_web/components/layouts/app.html.heex:7 -#: lib/music_library_web/controllers/stats_controller.ex:19 +#: lib/music_library_web/controllers/stats_controller.ex:21 #, elixir-autogen, elixir-format msgid "Stats" msgstr "" @@ -101,16 +101,6 @@ msgstr "" msgid "Previous" msgstr "" -#: lib/music_library_web/controllers/stats_html/index.html.heex:14 -#, elixir-autogen, elixir-format -msgid "Latest record" -msgstr "" - -#: lib/music_library_web/controllers/stats_html/index.html.heex:34 -#, elixir-autogen, elixir-format -msgid "Total Records" -msgstr "" - #: lib/music_library_web/live/record_live/form_component.ex:34 #: lib/music_library_web/live/record_live/form_component.ex:41 #, elixir-autogen, elixir-format @@ -324,3 +314,13 @@ msgstr "" #, elixir-autogen, elixir-format msgid "Login" msgstr "" + +#: lib/music_library_web/controllers/stats_html/index.html.heex:14 +#, elixir-autogen, elixir-format +msgid "Latest purchase" +msgstr "" + +#: lib/music_library_web/controllers/stats_html/index.html.heex:35 +#, elixir-autogen, elixir-format +msgid "Total collection" +msgstr ""