Add cost and duration metrics to homepage Task Status section

t-179·WorkTask·
·
·
·Omni/Jr.hs
Created5 months ago·Updated5 months ago·pipeline runs →

Description

Edit

The homepage Task Status section currently shows counts (Open, In Progress, Review, Approved, Done). Add two additional metric cards showing total cost and total work duration.

Design: Add two more cards to the stats-grid:

  • "Cost" - shows total cost in dollars (e.g., "$12.34")
  • "Duration" - shows total duration in human-readable format (e.g., "2h 15m")

Implementation:

1. Add fields to HomePage data type: data HomePage = HomePage TaskCore.TaskStats [TaskCore.Task] [TaskCore.Task] Bool AggregatedMetrics UTCTime (add AggregatedMetrics parameter)

2. In homeHandler, compute global aggregated metrics:

  • Query all activities for all tasks (not just descendants of an epic)
  • Sum cost_cents and duration from all completed activities
  • Create helper: getGlobalAggregatedMetrics :: IO AggregatedMetrics

3. In HomePage ToHtml instance, add two stat cards after Done:

  • Format cost: (aggTotalCostCents metrics) / 100 as "$X.XX"
  • Format duration: convert aggTotalDurationSeconds to "Xh Ym" format
  • Use neutral badge class (no status color), maybe "badge-neutral" or just gray

4. Add "badge-neutral" CSS if needed - gray background, dark text

The cards should not be clickable (no href) since they're aggregate metrics, not filterable categories.

Files: Omni/Jr/Web.hs (HomePage type, homeHandler, ToHtml instance), Omni/Task/Core.hs (getGlobalAggregatedMetrics)

Git Commits

f7b875b6Add cost and duration metrics to homepage Task Status section
Ben Sima5 months ago3 files

Timeline (0)

No activity yet.