Related to heronfief/front#71
This commit is contained in:
@@ -288,7 +288,7 @@ export class GameService {
|
||||
});
|
||||
await game.save({ session });
|
||||
if (game.teams.length <= 1) {
|
||||
await this.endGame(game, session);
|
||||
await this.endGame(game, game.teams[0], session);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -359,10 +359,12 @@ export class GameService {
|
||||
@WithTransaction
|
||||
async endGame(
|
||||
game: Document<Game> & Game,
|
||||
winner: Team,
|
||||
session?: mongoose.mongo.ClientSession,
|
||||
) {
|
||||
this.eventEmitter.emit('sse.game.' + game._id.toHexString(), {
|
||||
type: 'endGame',
|
||||
winner: winner._id.toHexString(),
|
||||
});
|
||||
await game.deleteOne({ session });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user