camp-api/lib/camp_api_web/controllers/grist_json.ex
2026-01-22 19:36:18 +01:00

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