mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 20:13:08 +02:00
refactor(backend): better argument name
This commit is contained in:
parent
1564651bf6
commit
a2d3544a08
1 changed files with 11 additions and 11 deletions
|
@ -43,15 +43,15 @@ export class FeaturedService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async getRankingOf(name: string, windowRange: number, limit: number): Promise<string[]> {
|
private async getRankingOf(name: string, windowRange: number, threshold: number): Promise<string[]> {
|
||||||
const currentWindow = this.getCurrentWindow(windowRange);
|
const currentWindow = this.getCurrentWindow(windowRange);
|
||||||
const previousWindow = currentWindow - 1;
|
const previousWindow = currentWindow - 1;
|
||||||
|
|
||||||
const [currentRankingResult, previousRankingResult] = await Promise.all([
|
const [currentRankingResult, previousRankingResult] = await Promise.all([
|
||||||
this.redisClient.zrange(
|
this.redisClient.zrange(
|
||||||
`${name}:${currentWindow}`, 0, limit, 'REV', 'WITHSCORES'),
|
`${name}:${currentWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
|
||||||
this.redisClient.zrange(
|
this.redisClient.zrange(
|
||||||
`${name}:${previousWindow}`, 0, limit, 'REV', 'WITHSCORES'),
|
`${name}:${previousWindow}`, 0, threshold, 'REV', 'WITHSCORES'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const ranking = new Map<string, number>();
|
const ranking = new Map<string, number>();
|
||||||
|
@ -95,22 +95,22 @@ export class FeaturedService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public getGlobalNotesRanking(limit: number): Promise<MiNote['id'][]> {
|
public getGlobalNotesRanking(threshold: number): Promise<MiNote['id'][]> {
|
||||||
return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, limit);
|
return this.getRankingOf('featuredGlobalNotesRanking', GLOBAL_NOTES_RANKING_WINDOW, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public getInChannelNotesRanking(channelId: MiNote['channelId'], limit: number): Promise<MiNote['id'][]> {
|
public getInChannelNotesRanking(channelId: MiNote['channelId'], threshold: number): Promise<MiNote['id'][]> {
|
||||||
return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, limit);
|
return this.getRankingOf(`featuredInChannelNotesRanking:${channelId}`, GLOBAL_NOTES_RANKING_WINDOW, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public getPerUserNotesRanking(userId: MiUser['id'], limit: number): Promise<MiNote['id'][]> {
|
public getPerUserNotesRanking(userId: MiUser['id'], threshold: number): Promise<MiNote['id'][]> {
|
||||||
return this.getRankingOf(`featuredPerUserNotesRanking:${userId}`, PER_USER_NOTES_RANKING_WINDOW, limit);
|
return this.getRankingOf(`featuredPerUserNotesRanking:${userId}`, PER_USER_NOTES_RANKING_WINDOW, threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public getHashtagsRanking(limit: number): Promise<string[]> {
|
public getHashtagsRanking(threshold: number): Promise<string[]> {
|
||||||
return this.getRankingOf('featuredHashtagsRanking', HASHTAG_RANKING_WINDOW, limit);
|
return this.getRankingOf('featuredHashtagsRanking', HASHTAG_RANKING_WINDOW, threshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue