Commit 5fc84552 authored by Maxim Filippov's avatar Maxim Filippov 🌚

Fix all count

parent 4079d66f
......@@ -82,7 +82,7 @@ defmodule Pleroma.Stats do
defp status_count do
%{
all: get_all_statuses_count(),
all: all_statuses_query() |> Repo.aggregate(:count, :id),
public: public_statuses_query() |> Repo.aggregate(:count, :id),
unlisted: unlisted_statuses_query() |> Repo.aggregate(:count, :id),
direct: direct_statuses_query() |> Repo.aggregate(:count, :id),
......@@ -90,8 +90,8 @@ defmodule Pleroma.Stats do
}
end
defp get_all_statuses_count do
Repo.aggregate(User.Query.build(%{local: true}), :sum, :note_count)
defp all_statuses_query do
from(o in Object, where: fragment("(?)->>'type' = 'Note'", o.data))
end
def public_statuses_query do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment