From 4dde40a7431b1d355eb0fcac011a2c71c86f85d3 Mon Sep 17 00:00:00 2001 From: ryo-ma Date: Sun, 31 Oct 2021 14:19:17 +0900 Subject: [PATCH] Split issues to openIssues and closedIssues --- src/github_api_client.ts | 5 ++++- src/user_info.ts | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/github_api_client.ts b/src/github_api_client.ts index b27e8ae..be86cf4 100644 --- a/src/github_api_client.ts +++ b/src/github_api_client.ts @@ -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 } } diff --git a/src/user_info.ts b/src/user_info.ts index 55b4fe3..c1b2572 100644 --- a/src/user_info.ts +++ b/src/user_info.ts @@ -12,7 +12,10 @@ export type GitHubUserRepository = { }; export type GitHubUserIssue = { - issues: { + openIssues: { + totalCount: number; + }; + closedIssues: { totalCount: number; }; }; @@ -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;