Skip to content

Commit

Permalink
[main] 🐛 Fix: 카운트다운 종료 이후 제출 안 한 플레이어 제출 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
koomchang committed May 11, 2024
1 parent d65bc29 commit 5d8090d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.chatty.chatty.game.controller.dto;

import lombok.Builder;

@Builder
public record SubmitAnswerRequest(
Integer quizNumber,

String playerAnswer
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,18 @@ protected void quizCountDown(Long roomId) {
seconds--;
}
// seconds == -1
// 제출 안 한애들 빈값으로 제출 처리
AnswerData answerData = answerRepository.getAnswerData(roomId);
UsersSubmitStatus usersSubmitStatus = userSubmitStatusRepository.findByRoomId(roomId);
usersSubmitStatus.usersSubmitStatus().stream()
.filter(userSubmitStatus -> !userSubmitStatus.isSolved())
.forEach(userSubmitStatus -> {
answerData.addAnswer(userSubmitStatus.userId(),
SubmitAnswerRequest.builder().playerAnswer("").build());
userSubmitStatus.submit();
});
// 퀴즈 끝났으면 다음 퀴즈 반환 준비
QuizDTO solvedQuiz = gameRepository.getQuizData(roomId).getQuiz();
AnswerData answerData = answerRepository.getAnswerData(roomId);
log.info("Answer All Submitted: PlayerAnswers: {}", answerData.getPlayerAnswers());
markAndUpdateScore(roomId, solvedQuiz, answerData);
resetState(roomId);
Expand Down

0 comments on commit 5d8090d

Please sign in to comment.