diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx index f25f6a3..ae98ef3 100644 --- a/frontend/src/pages/HomePage.tsx +++ b/frontend/src/pages/HomePage.tsx @@ -150,7 +150,24 @@ export function HomePage() { .slice(0, 10); }, [mergedRuns, deployRuns]); - const lastRunDuration = useMemo(() => formatDuration(mergedRuns[0]?.durationMs), [mergedRuns]); + const combinedTotals = useMemo(() => { + const jobSuccess = metrics?.dailyStats.reduce((acc, d) => acc + (d.success || 0), 0) ?? 0; + const jobTotal = metrics?.dailyStats.reduce((acc, d) => acc + (d.total || 0), 0) ?? 0; + const deploySuccess = + deploymentMetrics?.dailyStats.reduce((acc, d) => acc + (d.success || 0), 0) ?? 0; + const deployTotal = + deploymentMetrics?.dailyStats.reduce((acc, d) => acc + (d.total || 0), 0) ?? 0; + const totalRuns = jobTotal + deployTotal; + const successRate = totalRuns + ? Math.round(((jobSuccess + deploySuccess) / totalRuns) * 100) + : 0; + return { totalRuns, successRate }; + }, [metrics, deploymentMetrics]); + + const lastRunDuration = useMemo(() => { + const latest = activityItems[0]; + return formatDuration(latest?.durationMs); + }, [activityItems]); return (