diff --git a/api/index.js b/api/index.js index 6ea4ffe0c20e7..2d477c337196a 100644 --- a/api/index.js +++ b/api/index.js @@ -28,6 +28,7 @@ export default async (req, res) => { hide_rank, show_icons, include_all_commits, + count_private, commits_year, line_height, title_color, @@ -94,6 +95,7 @@ export default async (req, res) => { showStats.includes("discussions_started"), showStats.includes("discussions_answered"), parseInt(commits_year, 10), + parseBoolean(count_private), ); const cacheSeconds = resolveCacheSeconds({ requested: parseInt(cache_seconds, 10), diff --git a/src/fetchers/stats.js b/src/fetchers/stats.js index 376a15816144e..1371702993ad9 100644 --- a/src/fetchers/stats.js +++ b/src/fetchers/stats.js @@ -45,6 +45,7 @@ const GRAPHQL_STATS_QUERY = ` login commits: contributionsCollection (from: $startTime) { totalCommitContributions, + restrictedContributionsCount, } reviews: contributionsCollection { totalPullRequestReviewContributions @@ -232,6 +233,7 @@ const fetchStats = async ( include_discussions = false, include_discussions_answers = false, commits_year, + count_private = false, ) => { if (!username) { throw new MissingParamError(["username"]); @@ -290,6 +292,9 @@ const fetchStats = async ( stats.totalCommits = await totalCommitsFetcher(username); } else { stats.totalCommits = user.commits.totalCommitContributions; + if (count_private) { + stats.totalCommits += user.commits.restrictedContributionsCount; + } } stats.totalPRs = user.pullRequests.totalCount;