@@ -12,10 +12,10 @@ import { VersionPlayerEntity } from 'gameserver/model/version-player.entity';
12
12
13
13
export type Summary =
14
14
| undefined
15
- | ( Omit < PlayerSummaryDto , ' rank' | ' newbieUnrankedGamesLeft' > & {
15
+ | ( Omit < PlayerSummaryDto , " rank" | " newbieUnrankedGamesLeft" > & {
16
16
ranked_games : number ;
17
17
unranked_games : number ;
18
- any_games : number ;
18
+ any_games : number ;
19
19
} ) ;
20
20
21
21
// TODO: we probably need to orm this shit up
@@ -30,7 +30,7 @@ export class PlayerService {
30
30
private readonly connection : Connection ,
31
31
) { }
32
32
33
- @cached ( 100 , ' getRank' )
33
+ @cached ( 100 , " getRank" )
34
34
public async getRank (
35
35
version : Dota2Version ,
36
36
steam_id : string ,
@@ -77,7 +77,7 @@ where p.mmr > $3
77
77
return rank2 [ 0 ] . count + 1 ;
78
78
}
79
79
80
- @cached ( 100 , ' heroStats' )
80
+ @cached ( 100 , " heroStats" )
81
81
async heroStats (
82
82
version : Dota2Version ,
83
83
steam_id : string ,
@@ -103,7 +103,7 @@ group by pim.hero, pim."playerId"
103
103
) ;
104
104
}
105
105
106
- @cached ( 100 , ' winrateLastRankedGames' )
106
+ @cached ( 100 , " winrateLastRankedGames" )
107
107
async winrateLastRankedGames ( steam_id : string ) : Promise < number > {
108
108
const some : { is_win : boolean } [ ] = await this . playerInMatchRepository
109
109
. query ( `
@@ -178,13 +178,13 @@ select p.steam_id,
178
178
avg(pim.deaths)::float as deaths,
179
179
avg(pim.assists)::float as assists,
180
180
sum(m.duration)::int as play_time,
181
- sum((m.matchmaking_mode = 0) ::int) as ranked_games,
181
+ sum((m.matchmaking_mode in ($2, $3)) ::int) as ranked_games,
182
182
-1 as rank
183
183
from cte p
184
184
inner join player_in_match pim on pim."playerId" = p.steam_id
185
185
inner join finished_match m on pim."matchId" = m.id
186
186
group by p.steam_id, p.recent_ranked_games, p.mmr, p.games, p.wins, p.any_games` ,
187
- [ steam_id ] ,
187
+ [ steam_id , MatchmakingMode . RANKED , MatchmakingMode . UNRANKED ] ,
188
188
) ;
189
189
190
190
return some [ 0 ] ;
0 commit comments