From d049f0688d851c7da3d97d98af72c45b7c283337 Mon Sep 17 00:00:00 2001 From: Anurag Hazra Date: Sat, 23 Oct 2021 13:50:33 +0530 Subject: [PATCH] fix: hotfix for graphql api error (#1409) --- src/fetchers/stats-fetcher.js | 7 +++++-- tests/api.test.js | 3 ++- tests/fetchStats.test.js | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index ce5a4af7fad8a..b0636d1b29ce2 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -25,7 +25,10 @@ const fetcher = (variables, token) => { pullRequests(first: 1) { totalCount } - issues(first: 1) { + openIssues: issues(states: OPEN) { + totalCount + } + closedIssues: issues(states: CLOSED) { totalCount } followers { @@ -114,7 +117,7 @@ async function fetchStats( const user = res.data.data.user; stats.name = user.name || user.login; - stats.totalIssues = user.issues.totalCount; + stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount; // normal commits stats.totalCommits = user.contributionsCollection.totalCommitContributions; diff --git a/tests/api.test.js b/tests/api.test.js index a468d5f57c9cd..ffdf5e1948597 100644 --- a/tests/api.test.js +++ b/tests/api.test.js @@ -35,7 +35,8 @@ const data = { restrictedContributionsCount: 100, }, pullRequests: { totalCount: stats.totalPRs }, - issues: { totalCount: stats.totalIssues }, + openIssues: { totalCount: stats.totalIssues }, + closedIssues: { totalCount: 0 }, followers: { totalCount: 0 }, repositories: { totalCount: 1, diff --git a/tests/fetchStats.test.js b/tests/fetchStats.test.js index e627e498a3535..f732182f8fe5a 100644 --- a/tests/fetchStats.test.js +++ b/tests/fetchStats.test.js @@ -14,7 +14,8 @@ const data = { restrictedContributionsCount: 50, }, pullRequests: { totalCount: 300 }, - issues: { totalCount: 200 }, + openIssues: { totalCount: 100 }, + closedIssues: { totalCount: 100 }, followers: { totalCount: 100 }, repositories: { totalCount: 5,