PhoenixKitProjects.RunningTiers (PhoenixKitProjects v0.23.2)

Copy Markdown View Source

The "Running" ordering the Overview dashboard used, lifted out so the projects.running dashboard widget (see DashboardWidgets) and the embeddable Web.OverviewLive rank projects identically.

Input is a tree summary (Projects.project_tree_summary/1) per active project; tag/2 stamps :tier + :late on it, prioritize/4 sorts and caps. Four tiers, in order:

  • :late — past planned_end (started_at + summed estimated durations) with progress < 100; with no durations at all, started ≥ 14 days ago. Most overdue first.
  • :near_done — progress ≥ 75 %. Highest progress first.
  • :on_track — the rest with tasks. Most recently started first.
  • :empty — no tasks. Sinks to the bottom regardless of age: nothing to measure, and recency alone would rank them above real work.

Summary

Functions

The Overview's default cap on displayed running projects.

Sorts tagged summaries by tier (see the moduledoc) and caps them. Returns {capped_list, total_count}.

Stamps :tier and :late on a tree summary.

The tier of one summary at now.

Types

tier()

@type tier() :: :late | :near_done | :on_track | :empty

Functions

default_display_limit()

@spec default_display_limit() :: pos_integer()

The Overview's default cap on displayed running projects.

prioritize(summaries, today, now, limit \\ 10)

@spec prioritize([map()], Date.t(), DateTime.t(), pos_integer()) ::
  {[map()], non_neg_integer()}

Sorts tagged summaries by tier (see the moduledoc) and caps them. Returns {capped_list, total_count}.

tag(summary, now)

@spec tag(map(), DateTime.t()) :: map()

Stamps :tier and :late on a tree summary.

tier(summary, now)

@spec tier(map(), DateTime.t()) :: tier()

The tier of one summary at now.