mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 21:05:16 +00:00
fix: wrong total commits (#490)
This commit is contained in:
parent
278d6a1739
commit
3c6c142c75
2 changed files with 11 additions and 6 deletions
|
|
@ -115,16 +115,21 @@ async function fetchStats(
|
||||||
stats.name = user.name || user.login;
|
stats.name = user.name || user.login;
|
||||||
stats.totalIssues = user.issues.totalCount;
|
stats.totalIssues = user.issues.totalCount;
|
||||||
|
|
||||||
|
// normal commits
|
||||||
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
|
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
|
||||||
|
|
||||||
if (count_private) {
|
// if include_all_commits then just get that,
|
||||||
stats.totalCommits += user.contributionsCollection.restrictedContributionsCount;
|
// since totalCommitsFetcher already sends totalCommits no need to +=
|
||||||
}
|
|
||||||
|
|
||||||
if (include_all_commits) {
|
if (include_all_commits) {
|
||||||
stats.totalCommits = await totalCommitsFetcher(username);
|
stats.totalCommits = await totalCommitsFetcher(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if count_private then add private commits to totalCommits so far.
|
||||||
|
if (count_private) {
|
||||||
|
stats.totalCommits +=
|
||||||
|
user.contributionsCollection.restrictedContributionsCount;
|
||||||
|
}
|
||||||
|
|
||||||
stats.totalPRs = user.pullRequests.totalCount;
|
stats.totalPRs = user.pullRequests.totalCount;
|
||||||
stats.contributedTo = user.repositoriesContributedTo.totalCount;
|
stats.contributedTo = user.repositoriesContributedTo.totalCount;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ describe("Test fetchStats", () => {
|
||||||
|
|
||||||
let stats = await fetchStats("anuraghazra", true, true);
|
let stats = await fetchStats("anuraghazra", true, true);
|
||||||
const rank = calculateRank({
|
const rank = calculateRank({
|
||||||
totalCommits: 1000,
|
totalCommits: 1050,
|
||||||
totalRepos: 5,
|
totalRepos: 5,
|
||||||
followers: 100,
|
followers: 100,
|
||||||
contributions: 61,
|
contributions: 61,
|
||||||
|
|
@ -126,7 +126,7 @@ describe("Test fetchStats", () => {
|
||||||
expect(stats).toStrictEqual({
|
expect(stats).toStrictEqual({
|
||||||
contributedTo: 61,
|
contributedTo: 61,
|
||||||
name: "Anurag Hazra",
|
name: "Anurag Hazra",
|
||||||
totalCommits: 1000,
|
totalCommits: 1050,
|
||||||
totalIssues: 200,
|
totalIssues: 200,
|
||||||
totalPRs: 300,
|
totalPRs: 300,
|
||||||
totalStars: 400,
|
totalStars: 400,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue