From 6be67bc6c2f2b312a1d30c82a75d3ecd490c31c2 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Wed, 24 May 2023 14:23:35 +0300 Subject: [PATCH] Carry _sample_factor from right side to left in join (#2962) --- lib/plausible/stats/base.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/plausible/stats/base.ex b/lib/plausible/stats/base.ex index 901428888..b509f440c 100644 --- a/lib/plausible/stats/base.ex +++ b/lib/plausible/stats/base.ex @@ -424,7 +424,10 @@ defmodule Plausible.Stats.Base do if Query.has_event_filters?(query) do converted_sessions = from(e in query_events(site, query), - select: %{session_id: fragment("DISTINCT ?", e.session_id)} + select: %{ + session_id: fragment("DISTINCT ?", e.session_id), + _sample_factor: fragment("_sample_factor") + } ) from(s in db_query,