Skip to content

Commit

Permalink
Hotfix (#35)
Browse files Browse the repository at this point in the history
* IndexOutOfBounds 에러

* quizId 가 1 부터시작인데 isQuizAvailable배열은 0부터 시작

* FCFSFinished Exception 제거
선착순 퀴즈 마감되었어도 getQuiz()는 정상 작동

* 11시 58분

* 2시 15분으로 배포

* hotfix 끝

* 3시 15분으로 다시 수정
  • Loading branch information
bjh3311 authored Aug 23, 2024
1 parent 9959bdb commit ad9ccb8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package newCar.event_page.exception;

import newCar.event_page.exception.FCFS.FCFSFinishedException;
import newCar.event_page.exception.FCFS.FCFSNotStartedYet;
import newCar.event_page.exception.FCFS.FCFSNotYetConductedException;
import org.springframework.http.HttpStatus;
Expand Down Expand Up @@ -33,11 +32,6 @@ public ResponseEntity<String> handleUnmodifiableFieldException(final RuntimeExce
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
}

@ExceptionHandler(FCFSFinishedException.class)
public ResponseEntity<String> handleFCFSFinishedException(final RuntimeException e){
return ResponseEntity.status(HttpStatus.GONE).body(e.getMessage());
}

@ExceptionHandler(FCFSNotStartedYet.class)
public ResponseEntity<String> handleFCFSNotStartedException(final RuntimeException e){
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(e.getMessage());
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/newCar/event_page/service/UserServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import newCar.event_page.config.JwtConfig;
import newCar.event_page.exception.FCFS.FCFSFinishedException;
import newCar.event_page.exception.FCFS.FCFSNotStartedYet;
import newCar.event_page.exception.UserAlreadyHasTeamException;
import newCar.event_page.exception.UserLoginFailException;
Expand Down Expand Up @@ -110,11 +109,8 @@ public ResponseEntity<UserQuizDTO> getQuiz(Long quizEventId ) {
throw new IndexOutOfBoundsException("이벤트 기간이 지났습니다");
}

if(!isQuizAvailable.get(todayQuiz.getId().intValue()-1)){
throw new FCFSFinishedException("선착순 퀴즈가 마감되었습니다");
}//오늘 퀴즈가 마감되었다면

if(LocalDateTime.now(ZoneId.of("Asia/Seoul")).toLocalTime().isBefore(LocalTime.of(10, 15))){
if(LocalDateTime.now(ZoneId.of("Asia/Seoul")).toLocalTime().isBefore(LocalTime.of(3, 15))){
throw new FCFSNotStartedYet("퀴즈가 아직 시작되지 않았습니다");
}//퀴즈가 아직 시작 안되었다면

Expand Down Expand Up @@ -360,9 +356,9 @@ private void quizBranch(Integer userAnswer, Long id, Map<String, UserQuizStatus>
return;
}//유저의 답변이 퀴즈 정답과 일치하지 않을 시

int quizId = Integer.parseInt(todayQuiz.getId().toString());
int quizId = Integer.parseInt(todayQuiz.getId().toString()) -1;

if(!isQuizAvailable.get(quizId-1)){
if(!isQuizAvailable.get(quizId)){
map.put("status", UserQuizStatus.END);
return;
}//이미 마감되어 있다면
Expand Down

0 comments on commit ad9ccb8

Please sign in to comment.