X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fcounter_cache.ex;h=1e75d19ae0ef83d12f05ceaf8398d9914e49105b;hb=2e59cdd80f3e3d14c59aeba1fde2f8f9b8305e1f;hp=a940b5e50cca97ef1605a5d81014888256b7f143;hpb=942093683a1e6b3f3d3692268b2af8390da6d325;p=akkoma
diff --git a/lib/pleroma/counter_cache.ex b/lib/pleroma/counter_cache.ex
index a940b5e50..1e75d19ae 100644
--- a/lib/pleroma/counter_cache.ex
+++ b/lib/pleroma/counter_cache.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.CounterCache do
@@ -40,19 +40,15 @@ defmodule Pleroma.CounterCache do
end
end
- def get_sum() do
+ def get_sum do
CounterCache
|> select([c], %{
- "public" => sum(c.public),
- "unlisted" => sum(c.unlisted),
- "private" => sum(c.private),
- "direct" => sum(c.direct)
+ "public" => type(sum(c.public), :integer),
+ "unlisted" => type(sum(c.unlisted), :integer),
+ "private" => type(sum(c.private), :integer),
+ "direct" => type(sum(c.direct), :integer)
})
|> Repo.one()
- |> Enum.map(fn {visibility, dec_count} ->
- {visibility, Decimal.to_integer(dec_count)}
- end)
- |> Enum.into(%{})
end
def set(instance, values) do