This commit is contained in:
syuilo 2023-10-06 17:01:06 +09:00
parent 0bdbdba9f8
commit 7d289c1b77
1 changed files with 4 additions and 10 deletions

View File

@ -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 @bindThis
private getCurrentWindow(windowRange: number): number { private getCurrentWindow(windowRange: number): number {
const passed = new Date().getTime() - new Date(new Date().getFullYear(), 0, 1).getTime(); const passed = new Date().getTime() - new Date(new Date().getFullYear(), 0, 1).getTime();
@ -79,22 +73,22 @@ export class FeaturedService {
} }
@bindThis @bindThis
public async updateGlobalNotesRanking(noteId: MiNote['id'], score = 1): Promise<void> { public updateGlobalNotesRanking(noteId: MiNote['id'], score = 1): Promise<void> {
return this.updateRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, noteId, score); return this.updateRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, noteId, score);
} }
@bindThis @bindThis
public async updateInChannelNotesRanking(noteId: MiNote['id'], channelId: MiNote['channelId'], score = 1): Promise<void> { public updateInChannelNotesRanking(noteId: MiNote['id'], channelId: MiNote['channelId'], score = 1): Promise<void> {
return this.updateRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, noteId, score); return this.updateRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, noteId, score);
} }
@bindThis @bindThis
public async getGlobalNotesRanking(limit: number): Promise<MiNote['id'][]> { public getGlobalNotesRanking(limit: number): Promise<MiNote['id'][]> {
return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, limit); return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, limit);
} }
@bindThis @bindThis
public async getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise<MiNote['id'][]> { public getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise<MiNote['id'][]> {
return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, limit); return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, limit);
} }
} }