- user_count = Repo.aggregate(User.Query.build(%{local: true, active: true}), :count, :id)
+ status_count = Repo.aggregate(User.Query.build(%{local: true}), :sum, :note_count)
+
+ users_query =
+ from(u in User,
+ where: u.is_active == true,
+ where: u.local == true,
+ where: not is_nil(u.nickname),
+ where: not u.invisible
+ )
+
+ remote_users_query =
+ from(u in User,
+ where: u.is_active == true,
+ where: u.local == false,
+ where: not is_nil(u.nickname),
+ where: not u.invisible
+ )
+
+ user_count = Repo.aggregate(users_query, :count, :id)
+ remote_user_count = Repo.aggregate(remote_users_query, :count, :id)