Fix errors on stat page for empty site

This commit is contained in:
byte[] 2021-10-03 17:58:14 -04:00
parent ea96900707
commit c4b67ba30d
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ elixir:
p
' There are, on average,
span.stat>
= number_with_delimiter(trunc(img_bucket["non_deleted"]["avg_comments"]["value"]))
= number_with_delimiter(trunc(img_bucket["non_deleted"]["avg_comments"]["value"] || 0))
' comments on each image on the site.
h3 Votes

View file

@ -8,7 +8,7 @@ defmodule PhilomenaWeb.StatView do
{
%{"doc_count" => min_docs},
%{"doc_count" => max_docs}
} = Enum.min_max_by(data, & &1["doc_count"], fn -> %{"doc_count" => 0} end)
} = Enum.min_max_by(data, & &1["doc_count"], fn -> {%{"doc_count" => 0}, %{"doc_count" => 0}} end)
graph_width = 950
graph_height = 475