mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 16:38:23 +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.totalIssues = user.issues.totalCount;
|
||||
|
||||
// normal commits
|
||||
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
|
||||
|
||||
if (count_private) {
|
||||
stats.totalCommits += user.contributionsCollection.restrictedContributionsCount;
|
||||
}
|
||||
|
||||
// if include_all_commits then just get that,
|
||||
// since totalCommitsFetcher already sends totalCommits no need to +=
|
||||
if (include_all_commits) {
|
||||
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.contributedTo = user.repositoriesContributedTo.totalCount;
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ describe("Test fetchStats", () => {
|
|||
|
||||
let stats = await fetchStats("anuraghazra", true, true);
|
||||
const rank = calculateRank({
|
||||
totalCommits: 1000,
|
||||
totalCommits: 1050,
|
||||
totalRepos: 5,
|
||||
followers: 100,
|
||||
contributions: 61,
|
||||
|
|
@ -126,7 +126,7 @@ describe("Test fetchStats", () => {
|
|||
expect(stats).toStrictEqual({
|
||||
contributedTo: 61,
|
||||
name: "Anurag Hazra",
|
||||
totalCommits: 1000,
|
||||
totalCommits: 1050,
|
||||
totalIssues: 200,
|
||||
totalPRs: 300,
|
||||
totalStars: 400,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue