Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 71 additions & 2 deletions src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ import {
Tooltip,
Legend,
ResponsiveContainer
} from 'recharts';
import { Paper, Typography, Box, Grid, Theme } from '@mui/material';
}from 'recharts';

import {
Paper,
Typography,
Box,
Grid,
Theme,
LinearProgress
} from '@mui/material';

interface GitHubItem {
id: number;
Expand Down Expand Up @@ -63,6 +71,21 @@ const Dashboard: React.FC<DashboardProps> = ({ totalIssues, totalPrs, data, them
.slice(0, 5);

const hasData = totalIssues > 0 || totalPrs > 0;
const totalContributions = totalIssues + totalPrs;

const healthScore = Math.min(
100,
Math.round((totalContributions / 50) * 100)
);
Comment on lines +76 to +79

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

The algorithm does not measure actual repository health.

The current implementation uses raw totals (totalIssues + totalPrs) regardless of state, which produces misleading results. A repository with 1000 open, unresolved issues would score "Excellent" (100/100), but that indicates poor health, not good health. Additionally, cumulative totals from the GitHub search API don't reflect current activity or maintenance quality.

Issue #719 requires analyzing:

  • Issue resolution rate (closed/total)
  • Pull request merge rate
  • Open vs closed issues ratio
  • Contributor activity trends
  • Repository update frequency

Consider refactoring to compute ratios and rates instead of raw counts. For example:

  • issueResolutionRate = closedIssues / totalIssues
  • openIssueRatio = openIssues / totalIssues
  • Weight and combine these metrics into a composite score
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Dashboard.tsx` around lines 76 - 79, The current healthScore
calculation using totalContributions is misleading; replace it with a composite
score computed from ratios (not raw counts). Compute metrics like
issueResolutionRate = closedIssues / totalIssues, openIssueRatio = openIssues /
totalIssues, prMergeRate = mergedPrs / totalPrs, contributorActivity =
recentContributorCount / totalContributors, and recencyScore from
lastCommitDate; then weight and combine these into a single healthScore (e.g.,
weighted sum normalized to 0–100) and update the code that references
healthScore and totalContributions so that healthScore uses these new ratio
variables instead of Math.round((totalContributions / 50) * 100). Ensure you
handle divide-by-zero (fallbacks when totalIssues or totalPrs are 0) and update
any UI labels that describe the metric.


const healthStatus =
healthScore >= 80
? "Excellent"
: healthScore >= 60
? "Good"
: healthScore >= 40
? "Moderate"
: "Poor";

if (!hasData) {
return (
Expand All @@ -76,6 +99,52 @@ const Dashboard: React.FC<DashboardProps> = ({ totalIssues, totalPrs, data, them

return (
<Box sx={{ mb: 4 }}>
<Paper
elevation={2}
sx={{
p: 3,
mb: 3,
textAlign: "center",
backgroundColor: theme.palette.background.paper,
}}
>
<Typography variant="h5" gutterBottom>
Repository Health Score
</Typography>

<Typography
variant="h2"
color="primary"
fontWeight="bold"
>
{healthScore}/100
</Typography>

<Typography
variant="h6"
color={
healthScore >= 80
? "success.main"
: healthScore >= 60
? "info.main"
: healthScore >= 40
? "warning.main"
: "error.main"
}
>
Status: {healthStatus}
</Typography>
<Box sx={{ mt: 2 }}>
<LinearProgress
variant="determinate"
value={healthScore}
sx={{
height: 12,
borderRadius: 5,
}}
/>
</Box>
</Paper>
<Grid container spacing={3}>
{/* Pie Chart: Issues vs PRs */}
<Grid item xs={12} md={6}>
Expand Down
Loading