From a92bca2c86ff3c701518da8a6e6502152ba7ed31 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Fri, 27 Nov 2020 10:27:47 +0200 Subject: [PATCH] Fix sites list when user has no sites --- lib/plausible/stats/clickhouse.ex | 1 + lib/plausible_web/templates/site/index.html.eex | 7 +++++-- .../controllers/site_controller_test.exs | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/plausible/stats/clickhouse.ex b/lib/plausible/stats/clickhouse.ex index 37dfad3c9..2142885d2 100644 --- a/lib/plausible/stats/clickhouse.ex +++ b/lib/plausible/stats/clickhouse.ex @@ -762,6 +762,7 @@ defmodule Plausible.Stats.Clickhouse do end) end + def last_24h_visitors([]), do: %{} def last_24h_visitors(sites) do domains = Enum.map(sites, & &1.domain) diff --git a/lib/plausible_web/templates/site/index.html.eex b/lib/plausible_web/templates/site/index.html.eex index 034cdf810..474f64abc 100644 --- a/lib/plausible_web/templates/site/index.html.eex +++ b/lib/plausible_web/templates/site/index.html.eex @@ -7,6 +7,10 @@