Skip to content

Commit

Permalink
#14 [Fix] 북마크 삭제 시 발생하는 NaN 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JSoi committed Jul 31, 2022
1 parent 0e999aa commit da10a85
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/com/mpnp/baechelin/store/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,22 @@ public Store updateBookmarkCount() {
this.bookMarkCount = this.getBookmarkList().size();
return this;
}
public void removeReview(Review review){

public void removeReview(Review review) {
this.reviewList.remove(review);
}

public void removeBookmark(Bookmark bookmark) {
this.bookmarkList.remove(bookmark);
}

public Store updatePointAvg() {
this.reviewCount = reviewList.size();
double totalPoint = 0.0;
for (Review review : reviewList) {
totalPoint += review.getPoint();
}
this.pointAvg = Double.parseDouble(String.format("%.1f", totalPoint / reviewList.size()));
this.pointAvg = reviewCount == 0 ? 0 : Double.parseDouble(String.format("%.1f", totalPoint / reviewList.size()));
return this;
}

Expand Down

0 comments on commit da10a85

Please sign in to comment.