Skip to content

Commit

Permalink
Add OG Account Trophy (ryo-ma#174)
Browse files Browse the repository at this point in the history
* Update trophy.ts

* Update trophy_list.ts
  • Loading branch information
SmashedFrenzy16 authored Jan 19, 2023
1 parent 7b8a6a4 commit 0184955
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/trophy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions src/trophy_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
MultipleLangTrophy,
LongTimeAccountTrophy,
AncientAccountTrophy,
OGAccountTrophy,
Joined2020Trophy,
AllSuperRankTrophy,
MultipleOrganizationsTrophy,
Expand All @@ -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),
);
Expand Down
5 changes: 5 additions & 0 deletions src/user_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -96,5 +100,6 @@ export class UserInfo {
this.durationYear = durationYear;
this.ancientAccount = ancientAccount;
this.joined2020 = joined2020;
this.ogAccount = ogAccount;
}
}

0 comments on commit 0184955

Please sign in to comment.