From d3972f728f5fd0d6e9d940bfb9e64a0ea5c2d5ca Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 8 Dec 2019 11:00:46 -0500 Subject: [PATCH] add missing gallery section --- .../controllers/stat_controller.ex | 8 +++++++- .../templates/stat/index.html.slime | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/philomena_web/controllers/stat_controller.ex b/lib/philomena_web/controllers/stat_controller.ex index 25a82958..aeef09d0 100644 --- a/lib/philomena_web/controllers/stat_controller.ex +++ b/lib/philomena_web/controllers/stat_controller.ex @@ -82,7 +82,13 @@ defmodule PhilomenaWeb.StatController do defp galleries do gallery_count = Repo.aggregate(Gallery, :count, :id) - gallery_size = Float.round(Repo.aggregate(Gallery, :avg, :image_count) || 0.0, 2) + + gallery_size = + Repo.aggregate(Gallery, :avg, :image_count) + |> Kernel.||(Decimal.new(0)) + |> Decimal.to_float() + |> trunc() + distinct_creators = Gallery |> distinct(:creator_id) diff --git a/lib/philomena_web/templates/stat/index.html.slime b/lib/philomena_web/templates/stat/index.html.slime index b965dc1e..d9ae0921 100644 --- a/lib/philomena_web/templates/stat/index.html.slime +++ b/lib/philomena_web/templates/stat/index.html.slime @@ -75,6 +75,24 @@ elixir: = number_with_delimiter(@users_24h) ' have joined in the last 24 hours. + h3 Galleries + p + ' There are + span.stat> + = number_with_delimiter(@gallery_count) + ' existing image galleries on the site, created by + span.stat> + = number_with_delimiter(@distinct_creators) + ' distinct creators. There are, on average, + span.stat> + = number_with_delimiter(@gallery_size) + ' images in each gallery. + p + ' In total, images have been added to galleries + span.stat> + = number_with_delimiter(@images_in_galleries) + ' times. + h3 Commissions p ' There are