Skip to content

Commit

Permalink
Fix: 배움나누기 페이징 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
nohy6630 committed May 23, 2024
1 parent 6b4bcd5 commit f2d7762
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface ExperienceRepositoryCustom {
List<Experience> findExperiencesOrderByLatest(long offset,long limit, String category, User user);
List<Experience> findExperiencesOrderByReview(long offset,long limit, String category, User user);

Long countExperiences(String category);
Long countExperiences(String category, User user);

List<Experience> findExperiencesForMain();
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ public List<Experience> findExperiencesOrderByReview(long offset, long limit, St
}

@Override
public Long countExperiences(String category) {
public Long countExperiences(String category, User me) {
BooleanBuilder builder = new BooleanBuilder();
builder.and(experience.user.ne(me));
if (category != null)
builder.and(experience.type.eq(ExperienceType.of(category)));
return jpaQueryFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ReadExperiencesRes readExperiences(ReadExperiencesReq readExperiencesReq)
long limit = EXPERIENCE_PAGE_SIZE;
if (category.equals("전체"))
category = null;
long pageCount = (experienceRepository.countExperiences(category) + EXPERIENCE_PAGE_SIZE - 1) / EXPERIENCE_PAGE_SIZE;
long pageCount = (experienceRepository.countExperiences(category, user) + EXPERIENCE_PAGE_SIZE - 1) / EXPERIENCE_PAGE_SIZE;
if (sort.equals("latest"))
return ReadExperiencesRes.of(page, pageCount, experienceRepository.findExperiencesOrderByLatest(offset, limit, category, user));
else if (sort.equals("review"))
Expand Down

0 comments on commit f2d7762

Please sign in to comment.