nodeinfo: report activeMonth and activeHalfyear users fields

This commit is contained in:
Alibek Omarov 2021-11-15 16:58:25 +01:00 committed by Gitea
commit 04aca335aa
3 changed files with 12 additions and 7 deletions

View file

@ -2474,8 +2474,8 @@ defmodule Pleroma.User do
|> update_and_set_cache()
end
def active_user_count(weeks \\ 4) do
active_after = Timex.shift(NaiveDateTime.utc_now(), weeks: -weeks)
def active_user_count(days \\ 30) do
active_after = Timex.shift(NaiveDateTime.utc_now(), days: -days)
__MODULE__
|> where([u], u.last_active_at >= ^active_after)