Skip to content

fix: correct issue metrics and engagement trend calculations#92

Open
nehayadav827 wants to merge 1 commit into
seetadev:mainfrom
nehayadav827:fix-issue-metrics-engagement-trends
Open

fix: correct issue metrics and engagement trend calculations#92
nehayadav827 wants to merge 1 commit into
seetadev:mainfrom
nehayadav827:fix-issue-metrics-engagement-trends

Conversation

@nehayadav827

Copy link
Copy Markdown

Description

This PR fixes two data correctness issues in src/lib/data-processing.ts related to BuilderOS analytics and engagement intelligence.

Both bugs caused dashboard charts to display misleading values even when valid contributor data was available.


1. Fix incorrect closed issue detection in processRawIssueMetrics()

The previous implementation attempted to detect closed issues by checking whether GitHub issue URLs contained the word "closed":

entry['Issue Link 1']?.includes('closed')

GitHub issue URLs do not encode issue state, so this condition never worked reliably.

As a result:

  • closedIssues was frequently incorrect
  • open/closed charts became misleading
  • fallback logic relied on a hardcoded percentage approximation

Fix

Closed issue detection now uses contributor-provided issue description fields and checks for natural completion indicators such as:

  • closed
  • resolved
  • merged

2. Fix engagement trend aggregation in calculateEngagementTrends()

The previous implementation returned hardcoded zero values for:

  • High Engagement
  • Medium Engagement
  • Low Engagement

even when engagement data existed in the dataset.

Fix

The updated implementation now calculates engagement bands dynamically using the same 1 / 2 / 3 participation prefix pattern already used elsewhere in the analytics pipeline.

This ensures weekly engagement trend charts correctly reflect contributor participation levels.


Changes

  • Fix incorrect closed issue detection logic
  • Fix engagement trend aggregation logic
  • Improve analytics accuracy for dashboard visualizations
  • Keep implementation scoped to src/lib/data-processing.ts
  • Reuse existing repository data patterns and conventions

Validation

A standalone local validation script was used during development to verify:

  • broken behaviour reproduction
  • corrected metric calculations
  • engagement aggregation correctness
  • chronological ordering
  • open + closed = total invariants

Validation output

Screenshot 2026-05-21 132926

Ran:

git diff --check

No formatting or whitespace issues were reported.


Additional Notes

Current repository checks still contain unrelated existing blockers:

  • npm run lint opens the interactive Next.js ESLint setup prompt because ESLint is not yet configured.
  • npm test -- --runInBand still contains a pre-existing unrelated mismatch in src/lib/__tests__/utils.test.ts.

No breaking changes introduced.


Checklist

  • I have tested this code
  • I have linked relevant issue(s)
  • I followed the code style of the project
  • I reviewed my own code

Relates to #68

@vercel

vercel Bot commented May 21, 2026

Copy link
Copy Markdown

@nehayadav827 is attempting to deploy a commit to the SEETA's projects Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant