Skip to content

Conversation

@webdev-mohdamir
Copy link
Contributor

Fixed an issue where merged PRs percentage could be NaN if the user has no PRs.
Fixes #4449

@vercel
Copy link

vercel bot commented Sep 21, 2025

@webdev-mohdamir is attempting to deploy a commit to the github readme stats Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the stats-card Feature, Enhancement, Fixes related to stats the stats card. label Sep 21, 2025
@qwerty541 qwerty541 requested a review from Copilot September 24, 2025 19:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a division by zero issue where the merged PRs percentage calculation would return NaN when a user has no pull requests. The fix implements proper fallback handling and includes comprehensive test coverage for this edge case.

  • Adds fallback logic to return 0% when calculating merged PR percentage with zero total PRs
  • Introduces test coverage for users with no pull requests to prevent regression

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/fetchers/stats.js Fixed division by zero in merged PR percentage calculation
tests/fetchStats.test.js Added test data and test case for users without pull requests

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@qwerty541 qwerty541 merged commit 4f17194 into anuraghazra:master Sep 24, 2025
7 of 8 checks passed
@qwerty541
Copy link
Collaborator

Hello @webdev-mohdamir

Thank you for your contribution!

harryzcy pushed a commit to harryzcy/github-readme-stats that referenced this pull request Sep 25, 2025
…raghazra#4452)

* Fix: When user doesn't have any PR, it's Merged PRs Percentage is NAN (fixes anuraghazra#4449)

* review

---------

Co-authored-by: Alexandr <[email protected]>
g8rdier added a commit to g8rdier/g8rdiers-github-readme-stats that referenced this pull request Oct 2, 2025
* ci: restrict repositories for theme pull requests closer workflow (anuraghazra#4463)

Co-authored-by: Alexandr <[email protected]>

* ci: set proper trigger event for theme pull requests closer workflow (anuraghazra#4464)

Co-authored-by: Alexandr <[email protected]>

* ci: update message in theme pull requests closer workflow (anuraghazra#4465)

Co-authored-by: Alexandr <[email protected]>

* fix: display correct data when user don't have any pull requests (anuraghazra#4452)

* Fix: When user doesn't have any PR, it's Merged PRs Percentage is NAN (fixes anuraghazra#4449)

* review

---------

Co-authored-by: Alexandr <[email protected]>

* feat: add Serbian (Latin) translations (anuraghazra#4448)

* Improve existing Serbian

* Distinguish Cyrillic & Latin Serbian

* Use sr for cyrillic Serbian to support backwards compatibility

* review

---------

Co-authored-by: Alexandr <[email protected]>

* build(deps-dev): bump @eslint/js from 9.35.0 to 9.36.0 (anuraghazra#4454)

Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.35.0 to 9.36.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.36.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.36.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr <[email protected]>

* build(deps-dev): bump eslint from 9.35.0 to 9.36.0 (anuraghazra#4455)

Bumps [eslint](https://github.com/eslint/eslint) from 9.35.0 to 9.36.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v9.35.0...v9.36.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.36.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr <[email protected]>

* build(deps-dev): bump eslint-plugin-jsdoc from 57.0.8 to 60.1.1 (anuraghazra#4453)

Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 57.0.8 to 60.1.1.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](gajus/eslint-plugin-jsdoc@v57.0.8...v60.1.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 60.1.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr <[email protected]>

* build(deps-dev): bump lint-staged from 16.1.6 to 16.2.0 (anuraghazra#4456)

Bumps [lint-staged](https://github.com/lint-staged/lint-staged) from 16.1.6 to 16.2.0.
- [Release notes](https://github.com/lint-staged/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/main/CHANGELOG.md)
- [Commits](lint-staged/lint-staged@v16.1.6...v16.2.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-version: 16.2.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr <[email protected]>

* ci(deps): bump bahmutov/npm-install from 1.10.10 to 1.11.0 (anuraghazra#4457)

Bumps [bahmutov/npm-install](https://github.com/bahmutov/npm-install) from 1.10.10 to 1.11.0.
- [Release notes](https://github.com/bahmutov/npm-install/releases)
- [Commits](bahmutov/npm-install@3714964...e5fe105)

---
updated-dependencies:
- dependency-name: bahmutov/npm-install
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexandr <[email protected]>

* chore: remove redundant gitattributes file (anuraghazra#4471)

Co-authored-by: Alexandr <[email protected]>

* chore: add more folders into vercelignore (anuraghazra#4473)

Co-authored-by: Alexandr <[email protected]>

* feat: add Catalan translations (anuraghazra#4134)

* Update translations.js

Catalan translation added

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* docs(readme): fix stats card options table markdown syntax (anuraghazra#4475)

* docs(readme): fix stats card options table markdown syntax

* Update readme.md

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* docs(readme): remove redundant steps words from tokens retrieval guides (anuraghazra#4476)

Co-authored-by: Alexandr <[email protected]>

* docs(readme): enhance the description of deploy first steps section (anuraghazra#4483)

Co-authored-by: Alexandr <[email protected]>

* docs(readme): update wording since token scopes is not about stats card only (anuraghazra#4484)

Co-authored-by: Alexandr <[email protected]>

* docs(readme): add warning about new wakatime accounts (anuraghazra#4485)

Co-authored-by: Alexandr <[email protected]>

* feat: add Filipino translations (anuraghazra#3800)

* Update translations.js

Added translations. Filipino Languages which is main language that Philippines used.

* Update translations.js

Added translations. Filipino language which is the main language 
of Philippines. Added translations in translations.js

* Update translations.js

* docs

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* fix: mark Filipino langiage as long for stats card (anuraghazra#4486)

Co-authored-by: Alexandr <[email protected]>

* feat: add Hebrew translations (anuraghazra#3957)

* Added Hebrew

* docs

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* docs(readme): add notice about hacktoberfest (anuraghazra#4491)

* docs(readme): add notice about hacktoberfest

* dev

---------

Co-authored-by: Alexandr <[email protected]>

* tests: use custom benchmarking solution instead of outdated `jest-bench` package (anuraghazra#4468)

* Remove jest-bench dependency and use custom solutions

* review

* Update tests/bench/calculateRank.bench.js

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* feat: update express.js to support containerized deployments + replicate the behaviour of the vercel app (anuraghazra#4345)

* Update express.js

This will help with containerized deployments and it replicates the behaviour of the vercel app

* Update express.js

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* feat: add Urdu translations (anuraghazra#3958)

* Update translations.js for Urdu language

I've added the translations for Urdu language for stats cards.

* docs

---------

Co-authored-by: MD SARFARAZ <[email protected]>
Co-authored-by: Alexandr <[email protected]>

* feat: add Bulgarian translations (anuraghazra#3987)

* Update translations.js

Added Bulgarian language translation

* Sorted languages alphabetically in translations.js

* docs

---------

Co-authored-by: mastersho <[email protected]>
Co-authored-by: Alexandr <[email protected]>

* fix: update Hindi translations (anuraghazra#4488)

* Fixed the trans in Hindi

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

* Update src/translations.js

Co-authored-by: Copilot <[email protected]>

* review

---------

Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Copilot <[email protected]>

* fix: update Malayalam translations (anuraghazra#4490)

Co-authored-by: Alexandr <[email protected]>

* docs(readme): fix deploy vercel instance link inside important notice (anuraghazra#4492)

Co-authored-by: Alexandr <[email protected]>

* fix: mark Bulgarian language as long for stats card (anuraghazra#4493)

Co-authored-by: Alexandr <[email protected]>

* docs(readme): fix environment variables link inside common options section (anuraghazra#4494)

Co-authored-by: Alexandr <[email protected]>

* style: fix prettier formatting

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Ophelia Goldstein <[email protected]>
Co-authored-by: Alexandr <[email protected]>
Co-authored-by: Mohd Amir <[email protected]>
Co-authored-by: Radoš Milićev <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alejandro Cabrera Carrasco <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Mark Anthony Tomas <[email protected]>
Co-authored-by: Ethan <[email protected]>
Co-authored-by: Chongyi Zheng <[email protected]>
Co-authored-by: EstoesMoises <[email protected]>
Co-authored-by: MD SARFARAZ <[email protected]>
Co-authored-by: MD SARFARAZ <[email protected]>
Co-authored-by: Mihail Kondov <[email protected]>
Co-authored-by: mastersho <[email protected]>
Co-authored-by: ranker-Aayush <[email protected]>
Co-authored-by: Dhia Shams <[email protected]>
martin-mfg pushed a commit to martin-mfg/github-readme-stats that referenced this pull request Nov 2, 2025
…raghazra#4452)

* Fix: When user doesn't have any PR, it's Merged PRs Percentage is NAN (fixes anuraghazra#4449)

* review

---------

Co-authored-by: Alexandr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stats-card Feature, Enhancement, Fixes related to stats the stats card.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NAN for Merged PRs Percentage

2 participants