Skip to content

Commit 4351745

Browse files
committed
haha what if it just works
1 parent 1a19fde commit 4351745

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/gameserver/model/game-server-session.entity.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,22 @@ export class GameServerSessionEntity {
3434
@Column({ name: "duration", default: 0 })
3535
duration: number;
3636

37-
@Column({ type: "timestamptz", default: () => 'now()' })
37+
@Column({ type: "timestamptz", default: () => "now()" })
3838
timestamp: Date;
3939

4040
@OneToMany(() => GameSessionPlayerEntity, (t) => t.session)
4141
players: Relation<GameSessionPlayerEntity>[];
4242

43-
44-
constructor(matchId: number, url: string, roomId: string, matchmaking_mode: MatchmakingMode, gameMode: Dota_GameMode, map: Dota_Map, gameState: Dota_GameRulesState, duration: number) {
43+
constructor(
44+
matchId: number,
45+
url: string,
46+
roomId: string,
47+
matchmaking_mode: MatchmakingMode,
48+
gameMode: Dota_GameMode,
49+
map: Dota_Map,
50+
gameState: Dota_GameRulesState,
51+
duration: number,
52+
) {
4553
this.matchId = matchId;
4654
this.url = url;
4755
this.roomId = roomId;

src/gameserver/repository/game-server-session.repository.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { PlayerId } from 'gateway/shared-types/player-id';
66
import { Repository } from 'typeorm';
77
import { InjectRepository } from '@nestjs/typeorm';
88
import { GameServerEntity } from 'gameserver/model/game-server.entity';
9+
import { Dota_GameRulesState } from 'gateway/shared-types/dota-game-rules-state';
910

1011
@Injectable()
1112
export class GameServerSessionRepository {
@@ -25,17 +26,18 @@ export class GameServerSessionRepository {
2526
having count(gssm) = 0`);
2627
}
2728

28-
2929
// FIXME: use proper query
3030
public async findWith(
3131
playerId: PlayerId,
3232
): Promise<GameServerSessionEntity | undefined> {
3333
const all = await this.gameServerSessionModelRepository.find();
3434

35-
return all.find((t) =>
36-
t.players.find(
37-
(z) => z.steamId === playerId.value && z.abandoned === false,
38-
),
35+
return all.find(
36+
(t) =>
37+
t.gameState !== Dota_GameRulesState.POST_GAME &&
38+
t.players.find(
39+
(z) => z.steamId === playerId.value && z.abandoned === false,
40+
),
3941
);
4042
}
4143
}

0 commit comments

Comments
 (0)