mirror of
https://github.com/plausible/analytics.git
synced 2024-11-25 07:06:11 +03:00
Update legacy parsing
This commit is contained in:
parent
20fea637c0
commit
e81e18ec57
@ -3,7 +3,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
use Plausible
|
||||
|
||||
alias Plausible.Stats.{Filters, Interval, Query}
|
||||
alias Plausible.Stats.{DateTimeRange, Filters, Interval, Query}
|
||||
|
||||
def from(site, params, debug_metadata) do
|
||||
now = NaiveDateTime.utc_now(:second)
|
||||
@ -44,7 +44,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
defp put_period(query, site, %{"period" => "day"} = params) do
|
||||
date = parse_single_date(site.timezone, params)
|
||||
|
||||
struct!(query, period: "day", date_range: Date.range(date, date))
|
||||
struct!(query, period: "day", date_range: DateTimeRange.new(date, date))
|
||||
end
|
||||
|
||||
defp put_period(query, site, %{"period" => "7d"} = params) do
|
||||
@ -54,7 +54,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
struct!(
|
||||
query,
|
||||
period: "7d",
|
||||
date_range: Date.range(start_date, end_date)
|
||||
date_range: DateTimeRange.new(start_date, end_date)
|
||||
)
|
||||
end
|
||||
|
||||
@ -62,7 +62,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
end_date = parse_single_date(site.timezone, params)
|
||||
start_date = end_date |> Date.shift(day: -30)
|
||||
|
||||
struct!(query, period: "30d", date_range: Date.range(start_date, end_date))
|
||||
struct!(query, period: "30d", date_range: DateTimeRange.new(start_date, end_date))
|
||||
end
|
||||
|
||||
defp put_period(query, site, %{"period" => "month"} = params) do
|
||||
@ -73,7 +73,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "month",
|
||||
date_range: Date.range(start_date, end_date)
|
||||
date_range: DateTimeRange.new(start_date, end_date)
|
||||
)
|
||||
end
|
||||
|
||||
@ -88,7 +88,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "6mo",
|
||||
date_range: Date.range(start_date, end_date)
|
||||
date_range: DateTimeRange.new(start_date, end_date)
|
||||
)
|
||||
end
|
||||
|
||||
@ -103,7 +103,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "12mo",
|
||||
date_range: Date.range(start_date, end_date)
|
||||
date_range: DateTimeRange.new(start_date, end_date)
|
||||
)
|
||||
end
|
||||
|
||||
@ -116,7 +116,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "year",
|
||||
date_range: Date.range(start_date, end_date)
|
||||
date_range: DateTimeRange.new(start_date, end_date)
|
||||
)
|
||||
end
|
||||
|
||||
@ -126,7 +126,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "all",
|
||||
date_range: Date.range(start_date, now)
|
||||
date_range: DateTimeRange.new(start_date, now)
|
||||
)
|
||||
end
|
||||
|
||||
@ -146,7 +146,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
|
||||
|
||||
struct!(query,
|
||||
period: "custom",
|
||||
date_range: Date.range(from_date, to_date)
|
||||
date_range: DateTimeRange.new(from_date, to_date)
|
||||
)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user