feat(web): sort Duration by Agent Type chart by totalDurationMs descending#914
Merged
feat(web): sort Duration by Agent Type chart by totalDurationMs descending#914
Conversation
nhopeatall
approved these changes
Mar 16, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.sort((a, b) => b.totalDurationMs - a.totalDurationMs)to the data pipeline inProjectWorkDurationChartso the most time-consuming agent type appears at the top of the horizontal bar chartbuildDurationChartDataso it can be unit-tested directly (following thecomputeDateFrompattern from the stats page)tests/unit/web/project-work-duration-chart.test.tswith 5 test cases covering: descending sort, zero-duration filtering, equal-duration stability, empty array, and null avgDurationMs handlingCard: https://trello.com/c/69b835201ca418f384ece9b6
Test plan
npm test tests/unit/web/project-work-duration-chart.test.ts) — 5/5npm run lint)npm run typecheck)/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