Skip to content

Commit

Permalink
#71 [FIX] 개인 대시보드에서 hasReview값 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yeseul106 committed Jul 21, 2023
1 parent 178c61e commit 35815bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public ProjectOwnPuzzleResponseDto getMyPuzzles(Long memberId, Long projectId, S
}

Boolean isReviewDay = checkTodayIsReviewDay(today, findProjectById(projectId).getReviewCycle());
Boolean hasTodayReview = reviewRepository.existsReviewByReviewDate(today);
Boolean hasTodayReview = reviewRepository.existsReviewByReviewDateAndMemberId(today, memberId);

List<PuzzleObjectDto> result = new ArrayList<>();
for (int idx = 1; idx <= pageSize; idx++) {
Expand Down Expand Up @@ -120,9 +120,10 @@ public ProjectTeamPuzzleResponseDto getTeamPuzzles(Principal principal, Long pro
if (today.equals("") || today == null) {
throw new BadRequestException(ErrorStatus.VALIDATION_REQUEST_MISSING_EXCEPTION.getMessage());
}
Long memberId = MemberUtil.getMemberId(principal);
Project findProject = findProjectById(projectId);
Boolean isReviewDay = checkTodayIsReviewDay(today, findProjectById(projectId).getReviewCycle());
Boolean hasTodayReview = reviewRepository.existsReviewByReviewDate(today);
Boolean hasTodayReview = reviewRepository.existsReviewByReviewDateAndMemberId(today, memberId);
List<Review> reviews = reviewRepository.findAllByProjectIdOrderByReviewDateAsc(projectId);

// 날짜별 리뷰 개수를 카운트하기 위한 Map 생성
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface ReviewRepository extends JpaRepository<Review, Long> {
@Query("SELECT r FROM Review r WHERE r.memberId = :memberId AND r.projectId = :projectId ORDER BY r.createdAt")
Page<Review> findByMemberIdAndProjectIdOrderByCreatedAt(@Param("memberId") Long memberId, @Param("projectId") Long projectId, Pageable pageable);

boolean existsReviewByReviewDate(String date);
boolean existsReviewByReviewDateAndMemberId(String date, Long memberId);

List<Review> findAllByProjectIdOrderByReviewDateAsc(Long projectId);

Expand Down

0 comments on commit 35815bd

Please sign in to comment.