diff --git a/src/main/java/com/semicolon/gspass/facade/user/UserFacadeImpl.java b/src/main/java/com/semicolon/gspass/facade/user/UserFacadeImpl.java index 7d9e809..62a282c 100644 --- a/src/main/java/com/semicolon/gspass/facade/user/UserFacadeImpl.java +++ b/src/main/java/com/semicolon/gspass/facade/user/UserFacadeImpl.java @@ -36,8 +36,6 @@ public School findById(Integer id) { @Override public GsPass save(GsPass gsPass) { - if(gsPassRepository.findByUser(gsPass.getUser()).isPresent()) - throw new GsPassAlreadyApplyException(); return gsPassRepository.save(gsPass); } diff --git a/src/main/java/com/semicolon/gspass/service/user/UserServiceImpl.java b/src/main/java/com/semicolon/gspass/service/user/UserServiceImpl.java index 4c42e4d..39f571f 100644 --- a/src/main/java/com/semicolon/gspass/service/user/UserServiceImpl.java +++ b/src/main/java/com/semicolon/gspass/service/user/UserServiceImpl.java @@ -156,19 +156,19 @@ public GsPassResponse getPassInfo() { if(gsPass.isUsed()) throw new GsPassNotFoundException(); int count = userFacade.unUsedPassCount(grade, gsPass.getId()); int allCount = userFacade.PassCount(grade, gsPass.getId()); - if (school.getDinnerPeriod() != null && school.getDinnerPeriod().toLocalTime().isBefore(LocalTime.now())) { + if (school.getDinnerPeriod() != null && grade.getDinner() != null && school.getDinnerPeriod().toLocalTime().isBefore(LocalTime.now())) { Duration duration = Duration.between(LocalTime.now(), grade.getDinner().toLocalTime().plusSeconds(5 * (allCount+1))); int hours = (int)duration.getSeconds() / 3600; int minutes = (int)(duration.getSeconds() % 3600) / 60; int seconds = (int)duration.getSeconds() % 60; return new GsPassResponse(count, LocalTime.of(hours, minutes, seconds)); - } else if (school.getLunchPeriod() != null && school.getLunchPeriod().toLocalTime().isBefore(LocalTime.now())) { + } else if (school.getLunchPeriod() != null && grade.getDinner() != null && school.getLunchPeriod().toLocalTime().isBefore(LocalTime.now())) { Duration duration = Duration.between(LocalTime.now(), grade.getLunch().toLocalTime().plusSeconds(5 * (allCount+1))); int hours = (int)duration.getSeconds() / 3600; int minutes = (int)(duration.getSeconds() % 3600) / 60; int seconds = (int)duration.getSeconds() % 60; return new GsPassResponse(count, LocalTime.of(hours, minutes, seconds)); - } else if (school.getBreakfastPeriod() != null && school.getBreakfastPeriod().toLocalTime().isBefore(LocalTime.now())) { + } else if (school.getBreakfastPeriod() != null && grade.getDinner() != null && school.getBreakfastPeriod().toLocalTime().isBefore(LocalTime.now())) { Duration duration = Duration.between(LocalTime.now(), grade.getBreakfast().toLocalTime().plusSeconds(5 * (allCount+1))); int hours = (int)duration.getSeconds() / 3600; int minutes = (int)(duration.getSeconds() % 3600) / 60;