Skip to content

Commit

Permalink
Split issues to openIssues and closedIssues
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo-ma committed Oct 31, 2021
1 parent b252228 commit 4dde40a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/github_api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export class GithubAPIClient {
const query = `
query userInfo($username: String!) {
user(login: $username) {
issues(first: 1) {
openIssues: issues(states: OPEN) {
totalCount
}
closedIssues: issues(states: CLOSED) {
totalCount
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/user_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export type GitHubUserRepository = {
};

export type GitHubUserIssue = {
issues: {
openIssues: {
totalCount: number;
};
closedIssues: {
totalCount: number;
};
};
Expand Down Expand Up @@ -84,7 +87,7 @@ export class UserInfo {
: 0;
this.totalCommits = totalCommits;
this.totalFollowers = userActivity.followers.totalCount;
this.totalIssues = userIssue.issues.totalCount;
this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount;
this.totalOrganizations = userActivity.organizations.totalCount;
this.totalPullRequests = userPullRequest.pullRequests.totalCount;
this.totalStargazers = totalStargazers;
Expand Down

0 comments on commit 4dde40a

Please sign in to comment.