diff --git a/src/routers/dashboard.py b/src/routers/dashboard.py index db0b5eb..0068382 100644 --- a/src/routers/dashboard.py +++ b/src/routers/dashboard.py @@ -321,10 +321,12 @@ async def tools_usage( for (tools,) in result.all(): for tool, cnt in (tools or {}).items(): combined[tool] += cnt - return sorted( - [ToolUsage(tool=t, count=c) for t, c in combined.items()], - key=lambda x: -x.count, - )[:15] + total = sum(combined.values()) + sorted_tools = sorted(combined.items(), key=lambda x: -x[1])[:15] + return [ + ToolUsage(tool=t, count=c, pct=round(c / total * 100, 1) if total > 0 else 0.0) + for t, c in sorted_tools + ] @router.get("/activity", response_model=list[SessionOut]) diff --git a/web/src/views/DashboardView.vue b/web/src/views/DashboardView.vue index 5352527..50aed09 100644 --- a/web/src/views/DashboardView.vue +++ b/web/src/views/DashboardView.vue @@ -199,7 +199,7 @@ const DOW_LABELS = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] :title="`${point.date}: ${formatDuration(point.hours)}`" >
@@ -235,7 +235,7 @@ const DOW_LABELS = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] class="flex-1 flex flex-col items-center gap-1" >