Skip to content

Commit

Permalink
hotfix: 퀴즈 데이터 가져오는 인덱싱 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-byeong committed Dec 5, 2024
1 parent c141fb1 commit 230e315
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/server/src/module/game/games/game.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {

const { classId, currentOrder, participantList } = gameInfo;
const quizData = JSON.parse(await this.redisService.get(`classId=${classId}`));
const currentQuizData = quizData[currentOrder];
const currentQuizData = quizData.find((quiz) => quiz.position === currentOrder);

const participantLength = participantList.length;

Expand Down Expand Up @@ -525,9 +525,10 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
}

matchingAnswer(selectedAnswer: Number[], currentChoicesData) {
console.log('currentChoicesData : ', currentChoicesData);
const correctAnswers = currentChoicesData
.map((choice) => (choice.isCorrect ? choice.position : null))
.filter((index) => index !== null);
.filter((choice) => choice.isCorrect)
.map((choice) => choice.position);

console.log('correctAnswers : ', correctAnswers);
console.log('selectedAnswer : ', selectedAnswer);
Expand Down

0 comments on commit 230e315

Please sign in to comment.