Expose more statistics
* differenciate local & all events/comments/groups * add instance follows/followings Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1076,6 +1076,17 @@ defmodule Mobilizon.Actors do
|
||||
|> Page.build_page(page, limit)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the number of followers for an actor
|
||||
"""
|
||||
@spec count_followers_for_actor(Actor.t()) :: integer()
|
||||
def count_followers_for_actor(%Actor{id: actor_id}) do
|
||||
actor_id
|
||||
|> follower_for_actor_query()
|
||||
|> where(approved: true)
|
||||
|> Repo.aggregate(:count)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the list of followings for an actor.
|
||||
If actor A follows actor B and C, actor A's followings are B and C.
|
||||
@@ -1087,6 +1098,17 @@ defmodule Mobilizon.Actors do
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the number of followings for an actor
|
||||
"""
|
||||
@spec count_followings_for_actor(Actor.t()) :: integer()
|
||||
def count_followings_for_actor(%Actor{id: actor_id}) do
|
||||
actor_id
|
||||
|> followings_for_actor_query()
|
||||
|> where(approved: true)
|
||||
|> Repo.aggregate(:count)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the list of external followings for an actor.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user