Add local groups as statistics

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-09-30 10:42:19 +02:00
parent 2dccd5eccd
commit a600720062
9 changed files with 79 additions and 5 deletions

View File

@@ -603,6 +603,25 @@ defmodule Mobilizon.Actors do
"""
def delete_group!(%Actor{type: :Group} = group), do: Repo.delete!(group)
@doc """
Counts the local groups
"""
@spec count_local_groups :: integer()
def count_local_groups do
groups_query()
|> filter_local()
|> Repo.aggregate(:count)
end
@doc """
Counts all the groups
"""
@spec count_groups :: integer()
def count_groups do
groups_query()
|> Repo.aggregate(:count)
end
@doc """
Lists the groups.
"""