Skip to content

Commit

Permalink
refactor: show quiz에서 quizMaxNum 값을 전달하도록 수정 (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
nowChae authored Nov 24, 2024
1 parent 25174b7 commit 481706a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/server/src/module/game/game.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { RedisService } from '../../config/database/redis/redis.service';
import { v4 as uuidv4 } from 'uuid';
import { GameService } from './games/game.service';

// socket - sid 맵핑

@WebSocketGateway({
cors: {
origin: '*',
Expand Down Expand Up @@ -145,12 +147,12 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
JSON.stringify(gameStatus),
);

const isLast = gameInfo.currentOrder === quizMaxNum ? true : false;
this.server.to(pinCode).emit('show quiz', { quizMaxNum, currentQuizData, isLast });

gameInfo.currentOrder += 1;
await this.redisService.set(`gameId=${pinCode}`, JSON.stringify(gameInfo));

const isLast = gameInfo.currentOrder === quizMaxNum ? true : false;
this.server.to(pinCode).emit('show quiz', { currentQuizData, isLast });

const startTime = Date.now();
await this.intervalTimeSender(pinCode, startTime, currentTimeLimit);
}
Expand Down

0 comments on commit 481706a

Please sign in to comment.