mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Set sum types in query
This commit is contained in:
parent
4c19702390
commit
f3f8ed9e19
|
@ -43,16 +43,12 @@ defmodule Pleroma.CounterCache do
|
||||||
def get_sum do
|
def get_sum do
|
||||||
CounterCache
|
CounterCache
|
||||||
|> select([c], %{
|
|> select([c], %{
|
||||||
"public" => sum(c.public),
|
"public" => type(sum(c.public), :integer),
|
||||||
"unlisted" => sum(c.unlisted),
|
"unlisted" => type(sum(c.unlisted), :integer),
|
||||||
"private" => sum(c.private),
|
"private" => type(sum(c.private), :integer),
|
||||||
"direct" => sum(c.direct)
|
"direct" => type(sum(c.direct), :integer)
|
||||||
})
|
})
|
||||||
|> Repo.one()
|
|> Repo.one()
|
||||||
|> Enum.map(fn {visibility, dec_count} ->
|
|
||||||
{visibility, Decimal.to_integer(dec_count)}
|
|
||||||
end)
|
|
||||||
|> Enum.into(%{})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(instance, values) do
|
def set(instance, values) do
|
||||||
|
|
Loading…
Reference in a new issue