0
0
Fork 0

ランキング非参加者を匿名表示に

This commit is contained in:
Xeltica 2023-03-24 02:25:24 +09:00
parent 890df5e111
commit 6ae8bed194
3 changed files with 14 additions and 9 deletions

View file

@ -23,9 +23,8 @@ export class RankingController {
*/
private async getResponse(isCalculating: boolean, limit?: number) {
const ranking = isCalculating ? [] : (await getRanking(limit)).map((u) => ({
id: u.id,
username: u.username,
host: u.host,
username: u.useRanking ? u.username : undefined,
host: u.useRanking ? u.host : undefined,
rating: u.rating,
}));
return {

View file

@ -8,8 +8,7 @@ import { User } from '../models/entities/user.js';
*/
export const getRanking = async (limit?: number | null): Promise<User[]> => {
const query = Users.createQueryBuilder('user')
.where('"user"."useRanking" IS TRUE')
.andWhere('"user"."bannedFromRanking" IS NOT TRUE')
.where('"user"."bannedFromRanking" IS NOT TRUE')
.andWhere('"user"."rating" <> \'NaN\'')
.orderBy('"user".rating', 'DESC');