View Source Glific.Stats (Glific v5.1.6)

The stats manager and API to interface with the stat sub-system

Link to this section Summary

Functions

Return the count of stats, using the same filter as list_stats

Top level function to generate stats for all active organizations by default. Can control behavior by setting function parameters

Returns the list of stats. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the stats itself.

Update a Stat

Get the details of the usage for this organization, from start_date to end_date both inclusive

Link to this section Functions

@spec count_stats(map()) :: integer()

Return the count of stats, using the same filter as list_stats

Link to this function

create_stat(attrs \\ %{})

View Source
@spec create_stat(map()) ::
  {:ok, Glific.Stats.Stat.t()} | {:error, Ecto.Changeset.t()}

Create a Stat

Link to this function

generate_stats(list \\ [], recent \\ true, opts \\ [])

View Source
@spec generate_stats(list(), boolean(), Keyword.t()) :: :ok

Top level function to generate stats for all active organizations by default. Can control behavior by setting function parameters

@spec list_stats(map()) :: list()

Returns the list of stats. Since this is very basic and only listing functionality we added the status filter like this. In future we will put the status as virtual filed in the stats itself.

Link to this function

update_stat(stat, attrs)

View Source
@spec update_stat(Glific.Stats.Stat.t(), map()) ::
  {:ok, Glific.Stats.Stat.t()} | {:error, Ecto.Changeset.t()}

Update a Stat

Link to this function

usage(organization_id, start_date, end_date)

View Source
@spec usage(non_neg_integer(), Date.t(), Date.t()) ::
  %{required(atom()) => pos_integer()} | nil

Get the details of the usage for this organization, from start_date to end_date both inclusive