Add OG Account Trophy (#174)

* Update trophy.ts

* Update trophy_list.ts
This commit is contained in:
SmashedFrenzy16 2023-01-19 11:45:46 +00:00 • committed by GitHub
parent 7b8a6a4100
commit 0184955871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View file

@ -199,6 +199,23 @@ export class MultipleOrganizationsTrophy extends Trophy{
}
}
export class OGAccountTrophy extends Trophy{
constructor(score: number){
const rankConditions = [
new RankCondition(
RANK.SECRET,
"OG User",
1,
),
];
super(score, rankConditions);
this.title = "OGUser";
this.filterTitles = ["OGUser"];
this.bottomMessage = "Joined 2008"
this.hidden = true;
}
}
export class TotalStarTrophy extends Trophy {
constructor(score: number) {
const rankConditions = [

View file

@ -9,6 +9,7 @@ import {
MultipleLangTrophy,
LongTimeAccountTrophy,
AncientAccountTrophy,
OGAccountTrophy,
Joined2020Trophy,
AllSuperRankTrophy,
MultipleOrganizationsTrophy,
@ -34,6 +35,7 @@ export class TrophyList {
new MultipleLangTrophy(userInfo.languageCount),
new LongTimeAccountTrophy(userInfo.durationYear),
new AncientAccountTrophy(userInfo.ancientAccount),
new OGAccountTrophy(userInfo.ogAccount),
new Joined2020Trophy(userInfo.joined2020),
new MultipleOrganizationsTrophy(userInfo.totalOrganizations),
);

View file

@ -51,6 +51,7 @@ export class UserInfo {
public readonly durationYear: number;
public readonly ancientAccount: number;
public readonly joined2020: number;
public readonly ogAccount: number;
constructor(
userActivity: GitHubUserActivity,
userIssue: GitHubUserIssue,
@ -85,6 +86,9 @@ export class UserInfo {
const joined2020 = new Date(userActivity.createdAt).getFullYear() == 2020
? 1
: 0;
const ogAccount =
new Date(userActivity.createdAt).getFullYear() <= 2008 ? 1 : 0;
this.totalCommits = totalCommits;
this.totalFollowers = userActivity.followers.totalCount;
this.totalIssues = userIssue.openIssues.totalCount + userIssue.closedIssues.totalCount;
@ -96,5 +100,6 @@ export class UserInfo {
this.durationYear = durationYear;
this.ancientAccount = ancientAccount;
this.joined2020 = joined2020;
this.ogAccount = ogAccount;
}
}