16 lines
327 B
Elixir
16 lines
327 B
Elixir
defmodule CampApiWeb.GristJSON do
|
|
alias CampApi.Grist.Gauge
|
|
|
|
def gauge(%{gauge: gauge}) do
|
|
%{gauge: gauge}
|
|
end
|
|
|
|
def fundraising(%{fundraising: fundraising}) do
|
|
total =
|
|
fundraising
|
|
|> Enum.map(fn record -> get_in(record, ["fields", "Montant"]) end)
|
|
|> Enum.sum()
|
|
|
|
%{total: total}
|
|
end
|
|
end
|