Added Total Reviews Trophy (#200)

This commit is contained in:
Bhav Beri 2023-05-18 20:33:15 +05:30 • committed by GitHub
parent 5378858628
commit 450f208327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 0 deletions

View file

@ -38,6 +38,7 @@ export class GithubAPIClient {
contributionsCollection { contributionsCollection {
totalCommitContributions totalCommitContributions
restrictedContributionsCount restrictedContributionsCount
totalPullRequestReviewContributions
} }
organizations(first: 1) { organizations(first: 1) {
totalCount totalCount

View file

@ -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 { export class TotalStarTrophy extends Trophy {
constructor(score: number) { constructor(score: number) {
const rankConditions = [ const rankConditions = [

View file

@ -6,6 +6,7 @@ import {
TotalIssueTrophy, TotalIssueTrophy,
TotalPullRequestTrophy, TotalPullRequestTrophy,
TotalRepositoryTrophy, TotalRepositoryTrophy,
TotalReviewsTrophy,
MultipleLangTrophy, MultipleLangTrophy,
LongTimeAccountTrophy, LongTimeAccountTrophy,
AncientAccountTrophy, AncientAccountTrophy,
@ -28,6 +29,7 @@ export class TrophyList {
new TotalIssueTrophy(userInfo.totalIssues), new TotalIssueTrophy(userInfo.totalIssues),
new TotalPullRequestTrophy(userInfo.totalPullRequests), new TotalPullRequestTrophy(userInfo.totalPullRequests),
new TotalRepositoryTrophy(userInfo.totalRepositories), new TotalRepositoryTrophy(userInfo.totalRepositories),
new TotalReviewsTrophy(userInfo.totalReviews),
); );
// Secret trophies // Secret trophies
this.trophies.push( this.trophies.push(

View file

@ -31,6 +31,7 @@ export type GitHubUserActivity = {
contributionsCollection: { contributionsCollection: {
totalCommitContributions: number; totalCommitContributions: number;
restrictedContributionsCount: number; restrictedContributionsCount: number;
totalPullRequestReviewContributions: number;
}; };
organizations: { organizations: {
totalCount: number; totalCount: number;
@ -45,6 +46,7 @@ export class UserInfo {
public readonly totalIssues: number; public readonly totalIssues: number;
public readonly totalOrganizations: number; public readonly totalOrganizations: number;
public readonly totalPullRequests: number; public readonly totalPullRequests: number;
public readonly totalReviews: number;
public readonly totalStargazers: number; public readonly totalStargazers: number;
public readonly totalRepositories: number; public readonly totalRepositories: number;
public readonly languageCount: number; public readonly languageCount: number;
@ -94,6 +96,7 @@ export class UserInfo {
this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount; this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount;
this.totalOrganizations = userActivity.organizations.totalCount; this.totalOrganizations = userActivity.organizations.totalCount;
this.totalPullRequests = userPullRequest.pullRequests.totalCount; this.totalPullRequests = userPullRequest.pullRequests.totalCount;
this.totalReviews = userActivity.contributionsCollection.totalPullRequestReviewContributions;
this.totalStargazers = totalStargazers; this.totalStargazers = totalStargazers;
this.totalRepositories = userRepository.repositories.totalCount; this.totalRepositories = userRepository.repositories.totalCount;
this.languageCount = languages.size; this.languageCount = languages.size;