Skip to content

Commit 2c47380

Browse files
anuraghazralencx
authored andcommitted
fix: hotfix for graphql api error (anuraghazra#1409)
1 parent 4275f07 commit 2c47380

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Diff for: src/fetchers/stats-fetcher.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ const fetcher = (variables, token) => {
2525
pullRequests(first: 1) {
2626
totalCount
2727
}
28-
issues(first: 1) {
28+
openIssues: issues(states: OPEN) {
29+
totalCount
30+
}
31+
closedIssues: issues(states: CLOSED) {
2932
totalCount
3033
}
3134
followers {
@@ -114,7 +117,7 @@ async function fetchStats(
114117
const user = res.data.data.user;
115118

116119
stats.name = user.name || user.login;
117-
stats.totalIssues = user.issues.totalCount;
120+
stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
118121

119122
// normal commits
120123
stats.totalCommits = user.contributionsCollection.totalCommitContributions;

Diff for: tests/api.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const data = {
3535
restrictedContributionsCount: 100,
3636
},
3737
pullRequests: { totalCount: stats.totalPRs },
38-
issues: { totalCount: stats.totalIssues },
38+
openIssues: { totalCount: stats.totalIssues },
39+
closedIssues: { totalCount: 0 },
3940
followers: { totalCount: 0 },
4041
repositories: {
4142
totalCount: 1,

Diff for: tests/fetchStats.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const data = {
1414
restrictedContributionsCount: 50,
1515
},
1616
pullRequests: { totalCount: 300 },
17-
issues: { totalCount: 200 },
17+
openIssues: { totalCount: 100 },
18+
closedIssues: { totalCount: 100 },
1819
followers: { totalCount: 100 },
1920
repositories: {
2021
totalCount: 5,

0 commit comments

Comments
 (0)