Also include LCTF games

This commit is contained in:
Brian Beck 2021-05-31 23:44:13 -07:00
parent e55c6ed9da
commit efdf44d7ba

View file

@ -193,14 +193,10 @@ export class PlayersService {
async findTopWins(topWinsQuery: TopWinsQueryDto) { async findTopWins(topWinsQuery: TopWinsQueryDto) {
const { minGames, limit } = topWinsQuery; const { minGames, limit } = topWinsQuery;
const gameType = 'CTFGame';
const query = this.playersRepository const query = this.playersRepository
.createQueryBuilder('player') .createQueryBuilder('player')
.setParameters({ .setParameters({ minGames })
gameType,
minGames,
})
.select(['stats.player_name', 'stats.player_guid']) .select(['stats.player_name', 'stats.player_guid'])
.addSelect('COUNT(stats.game_id)::integer', 'game_count') .addSelect('COUNT(stats.game_id)::integer', 'game_count')
.addSelect( .addSelect(
@ -300,7 +296,7 @@ export class PlayersService {
'join_g', 'join_g',
'join_g.game_id = game.game_id', 'join_g.game_id = game.game_id',
) )
.where('game.gametype = :gameType') .where("(game.gametype = 'CTFGame' OR game.gametype = 'SCtFGame')")
// Only count if the player's `gamePCT` was at least 67%. This is // Only count if the player's `gamePCT` was at least 67%. This is
// effectively how much of the match they were present for. // effectively how much of the match they were present for.
.andWhere("(game.stats->'gamePCT'->>0)::float >= 67") .andWhere("(game.stats->'gamePCT'->>0)::float >= 67")
@ -350,7 +346,7 @@ export class PlayersService {
// it's still useful to know what values were actually used, in case // it's still useful to know what values were actually used, in case
// defaults were used instead, values were clamped to min/max, etc. // defaults were used instead, values were clamped to min/max, etc.
minGames, minGames,
gameType, gameType: ['CTFGame', 'SCtFGame'],
limit, limit,
players, players,
}; };