Skip to content

Commit

Permalink
#23 [Update] 위치정보가 존재하지 않을 시 리턴되는 값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JSoi committed Jul 30, 2022
1 parent c0bbad0 commit c7eea0c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/main/java/com/mpnp/baechelin/review/domain/Review.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public Review(ReviewRequestDto reviewRequestDto, Store store, User user) throws
public void setImage(List<ReviewImage> reviewImageList){
this.reviewImageList = reviewImageList;
}
public void addSingleTag(Tag tag){
tag.setReview(this);
this.tagList.add(tag);
}

public void update(ReviewRequestDto reviewRequestDto){
this.point = reviewRequestDto.getPoint();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/mpnp/baechelin/store/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public Store updateBookmarkCount() {
return this;
}

// TODO 리뷰가 삭제될 때도 고려하기 - 삭제 후 적용되어야 함
public Store updatePointAvg() {
this.reviewCount = reviewList.size();
double totalPoint = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ private Page<Store> findBetweenOnePointOrderNullCase(BooleanBuilder builder,
.selectFrom(store)
.where(builder)
.limit(pageable.getPageSize())
.offset(pageable.getOffset())
.fetch();
int fetchCount = queryFactory.selectFrom(store).where(builder).fetch().size();
return new PageImpl<>(storeList, pageable, fetchCount);
return new PageImpl<>(storeList, pageable, storeList.size());
}

private OrderSpecifier<?> orderDistance(BigDecimal nowLat, BigDecimal nowLng) {
Expand Down Expand Up @@ -107,10 +105,8 @@ private Page<Store> findStoreOrderByPointNullCase(BooleanBuilder builder,
.where(builder)
.orderBy(store.pointAvg.desc())
.limit(pageable.getPageSize())
.offset(pageable.getOffset())
.fetch();
int fetchCount = queryFactory.selectFrom(store).where(builder).fetch().size();
return new PageImpl<>(storeList, pageable, fetchCount);
return new PageImpl<>(storeList, pageable, storeList.size());
}

public Page<Store> findStoreOrderByBookmark(BigDecimal lat,
Expand All @@ -122,8 +118,6 @@ public Page<Store> findStoreOrderByBookmark(BigDecimal lat,
if (lat == null || lng == null) return findStoreOrderByBookmarkNullCase(builder, pageable);
List<Store> storeList = queryFactory.selectFrom(store)
.where(builder)
.orderBy(store.bookMarkCount.desc())
.orderBy(orderDistance(lat, lng))
.limit(pageable.getPageSize())
.offset(pageable.getOffset())
.fetch();
Expand All @@ -138,10 +132,8 @@ public Page<Store> findStoreOrderByBookmarkNullCase(BooleanBuilder builder,
.where(builder)
.orderBy(store.bookMarkCount.desc())
.limit(pageable.getPageSize())
.offset(pageable.getOffset())
.fetch();
int fetchCount = queryFactory.selectFrom(store).where(builder).fetch().size();
return new PageImpl<>(storeList, pageable, fetchCount);
return new PageImpl<>(storeList, pageable, storeList.size());
}

// 주소로 검색, 검색어로 검색
Expand Down

0 comments on commit c7eea0c

Please sign in to comment.