Skip to content

feat(web): sort Duration by Agent Type chart by totalDurationMs descending#914

Merged
aaight merged 1 commit intodevfrom
feature/sort-duration-by-agent-type
Mar 16, 2026
Merged

feat(web): sort Duration by Agent Type chart by totalDurationMs descending#914
aaight merged 1 commit intodevfrom
feature/sort-duration-by-agent-type

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 16, 2026

Summary

  • Adds .sort((a, b) => b.totalDurationMs - a.totalDurationMs) to the data pipeline in ProjectWorkDurationChart so the most time-consuming agent type appears at the top of the horizontal bar chart
  • Extracts the data transformation into a named exported function buildDurationChartData so it can be unit-tested directly (following the computeDateFrom pattern from the stats page)
  • Adds tests/unit/web/project-work-duration-chart.test.ts with 5 test cases covering: descending sort, zero-duration filtering, equal-duration stability, empty array, and null avgDurationMs handling

Card: https://trello.com/c/69b835201ca418f384ece9b6

Test plan

  • Unit tests pass (npm test tests/unit/web/project-work-duration-chart.test.ts) — 5/5
  • Lint passes (npm run lint)
  • Type check passes (npm run typecheck)
  • Manual: Visit /projects/<id>/stats, verify "Duration by Agent Type" chart shows bars ordered longest → shortest top to bottom

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — Clean, minimal change that adds descending sort to the duration chart and extracts the data transformation into a testable function following the established computeDateFrom pattern. The sort logic is correct (b - a for descending), the extraction preserves all existing behavior (filter → map → sort), and the 5 test cases cover the important scenarios (descending order, zero-filtering, equal-duration stability, empty input, null coalescing). All CI checks pass.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit fa71797 into dev Mar 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants