mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Fix realtime conversion report (#260)
This commit is contained in:
parent
b29afdeb92
commit
e2e901df98
@ -649,7 +649,7 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
q =
|
||||
from(s in "sessions",
|
||||
where: s.domain == ^site.domain,
|
||||
where: s.start >= ^first_datetime and s.start < ^last_datetime
|
||||
where: s.timestamp >= ^first_datetime and s.start < ^last_datetime
|
||||
)
|
||||
|
||||
q =
|
||||
@ -708,17 +708,15 @@ defmodule Plausible.Stats.Clickhouse do
|
||||
end
|
||||
end
|
||||
|
||||
defp utc_boundaries(%Query{period: "30m"}, timezone) do
|
||||
last_datetime =
|
||||
NaiveDateTime.utc_now() |> Timex.to_datetime(timezone) |> Timex.Timezone.convert("UTC")
|
||||
defp utc_boundaries(%Query{period: "30m"}, _timezone) do
|
||||
last_datetime = NaiveDateTime.utc_now()
|
||||
|
||||
first_datetime = last_datetime |> Timex.shift(minutes: -30)
|
||||
{first_datetime, last_datetime}
|
||||
end
|
||||
|
||||
defp utc_boundaries(%Query{period: "realtime"}, timezone) do
|
||||
last_datetime =
|
||||
NaiveDateTime.utc_now() |> Timex.to_datetime(timezone) |> Timex.Timezone.convert("UTC")
|
||||
defp utc_boundaries(%Query{period: "realtime"}, _timezone) do
|
||||
last_datetime = NaiveDateTime.utc_now()
|
||||
|
||||
first_datetime = last_datetime |> Timex.shift(minutes: -5)
|
||||
{first_datetime, last_datetime}
|
||||
|
@ -218,7 +218,8 @@ defmodule Plausible.Test.ClickhouseSetup do
|
||||
session_id: @conversion_1_session_id,
|
||||
is_bounce: true,
|
||||
duration: 100,
|
||||
start: ~N[2019-01-01 02:00:00]
|
||||
start: ~N[2019-01-01 02:00:00],
|
||||
timestamp: ~N[2019-01-01 02:00:00]
|
||||
},
|
||||
%{
|
||||
domain: "test-site.com",
|
||||
@ -229,7 +230,8 @@ defmodule Plausible.Test.ClickhouseSetup do
|
||||
session_id: @conversion_2_session_id,
|
||||
is_bounce: false,
|
||||
duration: 0,
|
||||
start: ~N[2019-01-01 02:00:00]
|
||||
start: ~N[2019-01-01 02:00:00],
|
||||
timestamp: ~N[2019-01-01 02:00:00]
|
||||
},
|
||||
%{
|
||||
domain: "test-site.com",
|
||||
@ -239,7 +241,8 @@ defmodule Plausible.Test.ClickhouseSetup do
|
||||
referrer: "",
|
||||
is_bounce: false,
|
||||
duration: 100,
|
||||
start: ~N[2019-01-01 03:00:00]
|
||||
start: ~N[2019-01-01 03:00:00],
|
||||
timestamp: ~N[2019-01-01 03:00:00]
|
||||
},
|
||||
%{
|
||||
domain: "test-site.com",
|
||||
|
Loading…
Reference in New Issue
Block a user