From 0917e03fbba3c500305366aef0cc7ed710208da1 Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Fri, 19 May 2023 08:51:58 +0200 Subject: [PATCH] fix: enable 'count_private' again --- src/fetchers/stats-fetcher.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index aff7fcbd..11632387 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -179,7 +179,7 @@ const totalCommitsFetcher = async (username) => { */ const fetchStats = async ( username, - count_private = false, // unused + count_private = false, include_all_commits = false, exclude_repo = [], ) => { @@ -221,6 +221,7 @@ const fetchStats = async ( const user = res.data.data.user; stats.name = user.name || user.login; + stats.totalCommits = user.contributionsCollection.totalCommitContributions; // populate repoToHide map for quick lookup // while filtering out @@ -231,10 +232,15 @@ const fetchStats = async ( }); } + // Use include_all_commits fetch all commit using the REST API. if (include_all_commits) { stats.totalCommits = await totalCommitsFetcher(username); - } else { - stats.totalCommits = user.contributionsCollection.totalCommitContributions; + } + + // if count_private then add private contributions to totalCommits. + if (count_private) { + stats.totalCommits += + user.contributionsCollection.restrictedContributionsCount; } stats.totalPRs = user.pullRequests.totalCount;