Skip to content

Commit

Permalink
fix: hotfix for graphql api error (anuraghazra#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra authored and Kab1r committed Apr 4, 2022
1 parent adeb30b commit e2ab143
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/fetchers/stats-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tests/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion tests/fetchStats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e2ab143

Please sign in to comment.