- status_query = from p in Activity,
- where: p.local == ^true,
- where: fragment("?->'object'->>'type' = ?", p.data, ^"Note")
- status_count = Repo.aggregate(status_query, :count, :id)
- user_count = Repo.aggregate(User.local_user_query, :count, :id)
+
+ status_query =
+ from(u in User.local_user_query(), select: fragment("sum((?->>'note_count')::int)", u.info))
+
+ status_count = Repo.one(status_query)
+ user_count = Repo.aggregate(User.local_user_query(), :count, :id)
+