Skip to content

Commit

Permalink
Added Total Reviews Trophy (ryo-ma#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi authored May 18, 2023
1 parent 5378858 commit 450f208
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/github_api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class GithubAPIClient {
contributionsCollection {
totalCommitContributions
restrictedContributionsCount
totalPullRequestReviewContributions
}
organizations(first: 1) {
totalCount
Expand Down
50 changes: 50 additions & 0 deletions src/trophy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions src/trophy_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TotalIssueTrophy,
TotalPullRequestTrophy,
TotalRepositoryTrophy,
TotalReviewsTrophy,
MultipleLangTrophy,
LongTimeAccountTrophy,
AncientAccountTrophy,
Expand All @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions src/user_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type GitHubUserActivity = {
contributionsCollection: {
totalCommitContributions: number;
restrictedContributionsCount: number;
totalPullRequestReviewContributions: number;
};
organizations: {
totalCount: number;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 450f208

Please sign in to comment.