Sort formats by descending count in stats
This commit is contained in:
@@ -8,7 +8,9 @@ defmodule MusicLibraryWeb.StatsHTML do
|
|||||||
embed_templates "stats_html/*"
|
embed_templates "stats_html/*"
|
||||||
|
|
||||||
defp format_records_count(records_count_by_format) do
|
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)
|
Integer.to_string(count) <> " " <> Record.format_long_label(format)
|
||||||
end)
|
end)
|
||||||
|> Enum.join(", ")
|
|> Enum.join(", ")
|
||||||
|
|||||||
Reference in New Issue
Block a user