From 7d289c1b772bf94265ee7c7a49df1a6eca371fa7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 6 Oct 2023 17:01:06 +0900 Subject: [PATCH] refactor --- packages/backend/src/core/FeaturedService.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/core/FeaturedService.ts b/packages/backend/src/core/FeaturedService.ts index 5963b7fc39..e8a08cd866 100644 --- a/packages/backend/src/core/FeaturedService.ts +++ b/packages/backend/src/core/FeaturedService.ts @@ -19,12 +19,6 @@ export class FeaturedService { ) { } - @bindThis - private getCurrentPerUserFriendRankingWindow(): number { - const passed = new Date().getTime() - new Date(new Date().getFullYear(), 0, 1).getTime(); - return Math.floor(passed / (1000 * 60 * 60 * 24 * 7)); // 1週間ごと - } - @bindThis private getCurrentWindow(windowRange: number): number { const passed = new Date().getTime() - new Date(new Date().getFullYear(), 0, 1).getTime(); @@ -79,22 +73,22 @@ export class FeaturedService { } @bindThis - public async updateGlobalNotesRanking(noteId: MiNote['id'], score = 1): Promise { + public updateGlobalNotesRanking(noteId: MiNote['id'], score = 1): Promise { return this.updateRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, noteId, score); } @bindThis - public async updateInChannelNotesRanking(noteId: MiNote['id'], channelId: MiNote['channelId'], score = 1): Promise { + public updateInChannelNotesRanking(noteId: MiNote['id'], channelId: MiNote['channelId'], score = 1): Promise { return this.updateRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, noteId, score); } @bindThis - public async getGlobalNotesRanking(limit: number): Promise { + public getGlobalNotesRanking(limit: number): Promise { return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, limit); } @bindThis - public async getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise { + public getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise { return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, limit); } }