View Source Lightning.DashboardStats (Lightning v2.12.2)

Dashboard stats for a project and its workflows.

Summary

Functions

Link to this function

aggregate_project_metrics(workflows_stats)

View Source
Link to this function

filter_days_ago(query, days)

View Source
Link to this function

get_workflow_stats(workflow)

View Source
Link to this function

sort_workflow_stats(workflow_stats, sort_field, sort_direction)

View Source

Sorts a list of workflow statistics based on the specified field and direction.

Parameters

  • workflow_stats - A list of WorkflowStats structs to be sorted
  • sort_field - Atom representing the field to sort by, options include:
    • :last_workorder_updated_at - Sort by timestamp of the latest work order
    • :workorders_count - Sort by total count of work orders
    • :failed_workorders_count - Sort by count of failed work orders
  • sort_direction - Atom representing sort direction, either :asc or :desc

Returns

Sorted list of WorkflowStats structs

Examples

iex> sort_workflow_stats(workflow_stats, :workorders_count, :desc)
[%WorkflowStats{workorders_count: 100, ...}, %WorkflowStats{workorders_count: 50, ...}]

iex> sort_workflow_stats(workflow_stats, :last_workorder_updated_at, :asc)
[%WorkflowStats{last_workorder: %{updated_at: ~U[2023-01-01 00:00:00Z]}, ...}, ...]