mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +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
|
||||
|
||||
defp users do
|
||||
first_user = Repo.one(first(User))
|
||||
last_user = Repo.one(last(User))
|
||||
time = DateTime.utc_now() |> DateTime.add(-86400, :second)
|
||||
total =
|
||||
User
|
||||
|> Repo.aggregate(:count, :id)
|
||||
|
||||
last_24h =
|
||||
User
|
||||
|> where([u], u.created_at > ^time)
|
||||
|> where([u], u.created_at > ago(1, "day"))
|
||||
|> Repo.aggregate(:count, :id)
|
||||
|
||||
{diff(last_user, first_user), last_24h}
|
||||
{total, last_24h}
|
||||
end
|
||||
|
||||
defp galleries do
|
||||
|
|
Loading…
Reference in a new issue