X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fcounter_cache.ex;h=1e75d19ae0ef83d12f05ceaf8398d9914e49105b;hb=d3660b24d37862bb58cf309c582cfe7432fd7bb6;hp=a940b5e50cca97ef1605a5d81014888256b7f143;hpb=cbe383ae832f13d5d2a20ee8fb5e85498205fbc3;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