Skip to content

feat: add maintainer day-over-day stat deltas#522

Open
GhanshyamJha05 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
GhanshyamJha05:issue-450-day-over-day-deltas
Open

feat: add maintainer day-over-day stat deltas#522
GhanshyamJha05 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
GhanshyamJha05:issue-450-day-over-day-deltas

Conversation

@GhanshyamJha05

Copy link
Copy Markdown
Contributor

Summary

Adds day-over-day delta indicators to the maintainer dashboard stat tiles so maintainers can quickly compare today’s activity against yesterday’s values.

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other

Related Issue

Closes #450

What was changed?

  • Added day-over-day analytics for PRs opened, PRs merged, mentor reviews, and average review time.
  • Rendered compact delta badges on maintainer dashboard stat tiles.
  • Added safe fallback handling for older cached analytics payloads.
  • Added unit tests for UTC-based today vs yesterday delta calculations.

Screenshots

Not added. UI change is limited to maintainer dashboard stat tiles.

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npm run dev)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@GhanshyamJha05 is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Ayush-Patel-56 Ayush-Patel-56 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

line 207 in analytics.ts - query now fetches every PR ever ingested (removed the date filter). add .gte('github_created_at', yesterdayStart.toISOString()) to limit to 2 days. also dropping mentor_verified = true changes which PRs count toward avg review time - intentional? and line 237 - call buildDayOverDayStats directly instead of buildMaintainerAnalyticsTrends with empty arrays

@Ayush-Patel-56 Ayush-Patel-56 added the Needs author reply Author need to reply label Jul 1, 2026
@GhanshyamJha05

Copy link
Copy Markdown
Contributor Author

Ok will do shortly

.select('github_created_at, mentor_review_at')
.select('github_created_at, merged_at, mentor_review_at')
.in('repo_full_name', repos)
.eq('mentor_verified', true)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this filter means openedPrs and mergedPrs will only count already-verified PRs - nearly always 0, since PRs aren't verified at open time. need a second query without this filter for the opened/merged counts, keeping mentor_verified = true only for the review-time calculation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should i remove the merged for true check or add another similar block without check

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add a second query without the filter for opened/merged counts. keep the existing query (with mentor_verified = true) only for calculating review time. removing the filter entirely would break the review-time calculation.

Comment on lines +208 to +209
const yesterdayStart = new Date();
yesterdayStart.setDate(yesterdayStart.getDate() - 1);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

setDate uses local server time but buildDayOverDayStats uses UTC day boundaries - they can disagree near UTC midnight. use Date.UTC(...) instead to match.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ahh i see the dates are conflicting for the time zone ..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@GhanshyamJha05 are u working on this??

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintainer dashboard: day-over-day delta indicators on stat tiles

4 participants