- 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)
+
+ status_query =
+ from(u in User.Query.build(%{local: true}),
+ select: fragment("sum((?->>'note_count')::int)", u.info)
+ )
+
+ status_count = Repo.one(status_query)
+
+ user_count = Repo.aggregate(User.Query.build(%{local: true, active: true}), :count, :id)
+