Skip to content

fix(metrics): enforce commit count ranking and date window filtering … - #3257

Open
Nareshkumawat-star wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Nareshkumawat-star:fix/top-repos-commit-ranking
Open

fix(metrics): enforce commit count ranking and date window filtering …#3257
Nareshkumawat-star wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Nareshkumawat-star:fix/top-repos-commit-ranking

Conversation

@Nareshkumawat-star

Copy link
Copy Markdown

Summary

Ensures the TopRepos.tsx widget and /api/metrics/repos API route accurately rank repositories based on author commit count within the selected time range (7d / 30d / 90d). Repositories are queried via GitHub's Commit Search API (author:{login} author-date:>={since}), tallied per repo, cached via Supabase/Redis TTL cache, and rendered with commit count badges and relative progress bars.

Closes #3248


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • src/app/api/metrics/repos/route.ts: Uses GitHub Commit Search API (author:login author-date:>=sinceStr) to fetch user commits within the selected date window (days). Groups commits by repository, tallies counts, sorts descending by user commit count, and fetches top repository language breakdowns concurrently.
  • src/components/TopRepos.tsx: Renders repositories ordered by commit count with commit badges ({repo.commits} commits), relative bar widths, search filtering, pinning, bookmarking, and time-range selection (7d, 30d, 90d).

How to Test

  1. Navigate to the DevTrack dashboard and scroll to the Top Repositories widget.
  2. Select different time ranges (Last 7d, Last 30d, Last 90d).
  3. Verify that repositories are ordered by commit count within the selected window and display the correct commit badge count next to each repository.

Checklist

  • Self-reviewed my own diff
  • No unnecessary console.log or debug code
  • Commit count ranking logic verified
  • Cached via withMetricsCache to prevent rate limit issues

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) and removed gssoc26 GSSoC 2026 contribution labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Nareshkumawat-star

Copy link
Copy Markdown
Author

Hi @Priyanshu-byte-coder kindly review and merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] TopRepos widget shows repositories with 0 commits in the selected time range as 'most active'

1 participant