Sort formats by descending count in stats

This commit is contained in:
Claudio Ortolina
2024-10-07 15:05:54 +01:00
parent ddbda5b4d2
commit cd1331bbc6
@@ -8,7 +8,9 @@ defmodule MusicLibraryWeb.StatsHTML do
embed_templates "stats_html/*"
defp format_records_count(records_count_by_format) do
Enum.map(records_count_by_format, fn {format, count} ->
records_count_by_format
|> Enum.sort_by(fn {_format, count} -> count end, :desc)
|> Enum.map(fn {format, count} ->
Integer.to_string(count) <> " " <> Record.format_long_label(format)
end)
|> Enum.join(", ")