Skip to content

Commit

Permalink
develop 병합
Browse files Browse the repository at this point in the history
develop 병합
  • Loading branch information
leeseojune53 authored Jun 11, 2021
2 parents 2b0600d + 7bd00ae commit d1990b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1990b5

Please sign in to comment.