@@ -16,6 +16,7 @@ export type Summary =
16
16
ranked_games : number ;
17
17
unranked_games : number ;
18
18
any_games : number ;
19
+ bot_wins : number ;
19
20
} ) ;
20
21
21
22
// TODO: we probably need to orm this shit up
@@ -160,6 +161,7 @@ order by score desc`;
160
161
const some = await this . playerInMatchRepository . query (
161
162
`with cte as (select plr."playerId" as steam_id,
162
163
count(*)::int as any_games,
164
+ sum((m.winner = plr.team )::int)::int as bot_wins,
163
165
sum((m.matchmaking_mode in (0, 1))::int)::int as games,
164
166
sum((m.winner = plr.team and m.matchmaking_mode in (0, 1))::int)::int as wins,
165
167
sum((m.matchmaking_mode = 0 and m.timestamp > now() - '14 days'::interval)::int) as recent_ranked_games,
@@ -173,6 +175,7 @@ select p.steam_id,
173
175
p.wins,
174
176
p.games,
175
177
p.any_games,
178
+ p.bot_wins,
176
179
p.mmr as mmr,
177
180
avg(pim.kills)::float as kills,
178
181
avg(pim.deaths)::float as deaths,
@@ -183,7 +186,7 @@ select p.steam_id,
183
186
from cte p
184
187
inner join player_in_match pim on pim."playerId" = p.steam_id
185
188
inner join finished_match m on pim."matchId" = m.id
186
- group by p.steam_id, p.recent_ranked_games, p.mmr, p.games, p.wins, p.any_games` ,
189
+ group by p.steam_id, p.recent_ranked_games, p.mmr, p.games, p.wins, p.any_games, p.bot_wins ` ,
187
190
[ steam_id , MatchmakingMode . RANKED , MatchmakingMode . UNRANKED ] ,
188
191
) ;
189
192
0 commit comments