mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Add Purge.reset!/2
variant allowing to set arbitrary cutoff time
This commit is contained in:
parent
b2cd26b262
commit
6f294d5d58
@ -89,6 +89,7 @@ defmodule Plausible.Purge do
|
||||
:ok
|
||||
end
|
||||
|
||||
@spec reset!(Plausible.Site.t()) :: {:ok, Plausible.Site.t()}
|
||||
def reset!(site) do
|
||||
site
|
||||
|> Ecto.Changeset.change(
|
||||
@ -97,4 +98,14 @@ defmodule Plausible.Purge do
|
||||
)
|
||||
|> Plausible.Repo.update!()
|
||||
end
|
||||
|
||||
@spec reset!(Plausible.Site.t(), NaiveDateTime.t()) :: {:ok, Plausible.Site.t()}
|
||||
def reset!(site, timestap) do
|
||||
site
|
||||
|> Ecto.Changeset.change(
|
||||
native_stats_start_at: timestamp |> NaiveDateTime.truncate(:second),
|
||||
stats_start_date: nil
|
||||
)
|
||||
|> Plausible.Repo.update!()
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user