diff --git a/src/main/java/com/mpnp/baechelin/store/domain/Store.java b/src/main/java/com/mpnp/baechelin/store/domain/Store.java index 265fee9..5b458a4 100644 --- a/src/main/java/com/mpnp/baechelin/store/domain/Store.java +++ b/src/main/java/com/mpnp/baechelin/store/domain/Store.java @@ -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; }