Skip to content

Commit

Permalink
[BE] pending 정책 로직 부분 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Z1Park committed Dec 2, 2023
1 parent e17f590 commit 5aea841
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.ftclub.cabinet.cabinet.service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -288,9 +289,7 @@ private List<LentHistoryDto> generateLentHistoryDtoList(
@Transactional
public CabinetPendingResponseDto getPendingCabinets(String building) {
log.debug("getPendingCabinets");
final LocalDateTime pendingLimit = LocalDateTime.of(
LocalDateTime.now().toLocalDate().minusDays(1),
LocalTime.of(13, 0, 0));
final LocalDate yesterday = LocalDateTime.now().minusDays(1).toLocalDate();
List<Cabinet> buildingCabinets =
cabinetOptionalFetcher.findPendingCabinets(
building,
Expand All @@ -313,7 +312,7 @@ public CabinetPendingResponseDto getPendingCabinets(String building) {
LocalDateTime latestEndedAt = lentHistoriesMap.get(cabinet.getCabinetId()).stream()
.map(LentHistory::getEndedAt)
.max(LocalDateTime::compareTo).orElse(null);
if (latestEndedAt != null && latestEndedAt.isAfter(pendingLimit)) {
if (latestEndedAt != null && latestEndedAt.toLocalDate().isEqual(yesterday)) {
cabinetFloorMap.get(floor).add(cabinetMapper.toCabinetPreviewDto(cabinet, 0, null));
}
}
Expand Down

0 comments on commit 5aea841

Please sign in to comment.