Skip to content

Commit

Permalink
Updated Joined 2020 trophy to this Joined this year trophy
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavberi committed May 18, 2023
1 parent 5378858 commit 17bacff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/trophy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class AllSuperRankTrophy extends Trophy{
this.hidden = true;
}
}
export class Joined2020Trophy extends Trophy{
export class JoinedThisYearTrophy extends Trophy{
constructor(score: number){
const rankConditions = [
new RankCondition(
Expand All @@ -145,9 +145,9 @@ export class Joined2020Trophy extends Trophy{
),
];
super(score, rankConditions);
this.title = "Joined2020";
this.filterTitles = ["Joined2020"];
this.bottomMessage = "Joined 2020"
this.title = "New Joinee";
this.filterTitles = ["New", "JoinedThisYear"];
this.bottomMessage = `Joined ${new Date().getUTCFullYear()}`
this.hidden = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/trophy_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
LongTimeAccountTrophy,
AncientAccountTrophy,
OGAccountTrophy,
Joined2020Trophy,
JoinedThisYearTrophy,
AllSuperRankTrophy,
MultipleOrganizationsTrophy,
} from "./trophy.ts";
Expand All @@ -36,7 +36,7 @@ export class TrophyList {
new LongTimeAccountTrophy(userInfo.durationYear),
new AncientAccountTrophy(userInfo.ancientAccount),
new OGAccountTrophy(userInfo.ogAccount),
new Joined2020Trophy(userInfo.joined2020),
new JoinedThisYearTrophy(userInfo.joinedThisYear),
new MultipleOrganizationsTrophy(userInfo.totalOrganizations),
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/user_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class UserInfo {
public readonly languageCount: number;
public readonly durationYear: number;
public readonly ancientAccount: number;
public readonly joined2020: number;
public readonly joinedThisYear: number;
public readonly ogAccount: number;
constructor(
userActivity: GitHubUserActivity,
Expand Down Expand Up @@ -83,7 +83,7 @@ export class UserInfo {
const durationYear = new Date(durationTime).getUTCFullYear() - 1970;
const ancientAccount =
new Date(userActivity.createdAt).getFullYear() <= 2010 ? 1 : 0;
const joined2020 = new Date(userActivity.createdAt).getFullYear() == 2020
const joinedThisYear = new Date(userActivity.createdAt).getFullYear() == new Date().getUTCFullYear()
? 1
: 0;
const ogAccount =
Expand All @@ -99,7 +99,7 @@ export class UserInfo {
this.languageCount = languages.size;
this.durationYear = durationYear;
this.ancientAccount = ancientAccount;
this.joined2020 = joined2020;
this.joinedThisYear = joinedThisYear;
this.ogAccount = ogAccount;
}
}

0 comments on commit 17bacff

Please sign in to comment.