mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 21:47:59 +01:00
more accurate user statistics
This commit is contained in:
parent
136bfa7eda
commit
c38b50aafa
1 changed files with 5 additions and 5 deletions
|
@ -86,16 +86,16 @@ defmodule PhilomenaWeb.StatsUpdater do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp users do
|
defp users do
|
||||||
first_user = Repo.one(first(User))
|
total =
|
||||||
last_user = Repo.one(last(User))
|
User
|
||||||
time = DateTime.utc_now() |> DateTime.add(-86400, :second)
|
|> Repo.aggregate(:count, :id)
|
||||||
|
|
||||||
last_24h =
|
last_24h =
|
||||||
User
|
User
|
||||||
|> where([u], u.created_at > ^time)
|
|> where([u], u.created_at > ago(1, "day"))
|
||||||
|> Repo.aggregate(:count, :id)
|
|> Repo.aggregate(:count, :id)
|
||||||
|
|
||||||
{diff(last_user, first_user), last_24h}
|
{total, last_24h}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp galleries do
|
defp galleries do
|
||||||
|
|
Loading…
Reference in a new issue