Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Fix bug with `has_pageviews?`
Uku Taht761072d2858d
diff --git a/lib/plausible/stats/clickhouse.ex b/lib/plausible/stats/clickhouse.exindex 2080cabef6..80e7b46699 100644--- a/lib/plausible/stats/clickhouse.ex+++ b/lib/plausible/stats/clickhouse.ex@@ -407,6 +407,7 @@ defmodule Plausible.Stats.Clickhouse dores["visitors"]end+ def has_pageviews?([]), do: falsedef has_pageviews?(domains) when is_list(domains) dores = Clickhouse.all(from e in "events",diff --git a/test/plausible/auth/auth_test.exs b/test/plausible/auth/auth_test.exsindex 3b792faced..365bf5fb7f 100644--- a/test/plausible/auth/auth_test.exs+++ b/test/plausible/auth/auth_test.exs@@ -3,6 +3,12 @@ defmodule Plausible.AuthTest doalias Plausible.Authdescribe "user_completed_setup?" do+ test "is false if user does not have any sites" do+ user = insert(:user)++ refute Auth.user_completed_setup?(user)+ end+test "is false if user does not have any events" douser = insert(:user)insert(:site, members: [user])