diff --git a/src/github_api_client.ts b/src/github_api_client.ts index 3c5d6c8..c23bc60 100644 --- a/src/github_api_client.ts +++ b/src/github_api_client.ts @@ -38,6 +38,7 @@ export class GithubAPIClient { contributionsCollection { totalCommitContributions restrictedContributionsCount + totalPullRequestReviewContributions } organizations(first: 1) { totalCount diff --git a/src/trophy.ts b/src/trophy.ts index ff602e9..66d9f94 100644 --- a/src/trophy.ts +++ b/src/trophy.ts @@ -216,6 +216,56 @@ export class OGAccountTrophy extends Trophy{ } } +export class TotalReviewsTrophy extends Trophy { + constructor(score: number) { + const rankConditions = [ + new RankCondition( + RANK.SSS, + "God Reviewer", + 70, + ), + new RankCondition( + RANK.SS, + "Deep Reviewer", + 57, + ), + new RankCondition( + RANK.S, + "Super Reviewer", + 45, + ), + new RankCondition( + RANK.AAA, + "Ultra Reviewer", + 30, + ), + new RankCondition( + RANK.AA, + "Hyper Reviewer", + 20, + ), + new RankCondition( + RANK.A, + "Active Reviewer", + 8, + ), + new RankCondition( + RANK.B, + "Intermediate Reviewer", + 3, + ), + new RankCondition( + RANK.C, + "New Reviewer", + 1, + ), + ]; + super(score, rankConditions); + this.title = "Reviews"; + this.filterTitles = ["Review", "Reviews"]; + } +} + export class TotalStarTrophy extends Trophy { constructor(score: number) { const rankConditions = [ diff --git a/src/trophy_list.ts b/src/trophy_list.ts index 6d99519..7b5b9c5 100644 --- a/src/trophy_list.ts +++ b/src/trophy_list.ts @@ -6,6 +6,7 @@ import { TotalIssueTrophy, TotalPullRequestTrophy, TotalRepositoryTrophy, + TotalReviewsTrophy, MultipleLangTrophy, LongTimeAccountTrophy, AncientAccountTrophy, @@ -28,6 +29,7 @@ export class TrophyList { new TotalIssueTrophy(userInfo.totalIssues), new TotalPullRequestTrophy(userInfo.totalPullRequests), new TotalRepositoryTrophy(userInfo.totalRepositories), + new TotalReviewsTrophy(userInfo.totalReviews), ); // Secret trophies this.trophies.push( diff --git a/src/user_info.ts b/src/user_info.ts index e65f7eb..c2e47c3 100644 --- a/src/user_info.ts +++ b/src/user_info.ts @@ -31,6 +31,7 @@ export type GitHubUserActivity = { contributionsCollection: { totalCommitContributions: number; restrictedContributionsCount: number; + totalPullRequestReviewContributions: number; }; organizations: { totalCount: number; @@ -45,6 +46,7 @@ export class UserInfo { public readonly totalIssues: number; public readonly totalOrganizations: number; public readonly totalPullRequests: number; + public readonly totalReviews: number; public readonly totalStargazers: number; public readonly totalRepositories: number; public readonly languageCount: number; @@ -94,6 +96,7 @@ export class UserInfo { this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount; this.totalOrganizations = userActivity.organizations.totalCount; this.totalPullRequests = userPullRequest.pullRequests.totalCount; + this.totalReviews = userActivity.contributionsCollection.totalPullRequestReviewContributions; this.totalStargazers = totalStargazers; this.totalRepositories = userRepository.repositories.totalCount; this.languageCount = languages.size;