diff --git a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java index bd62ea5350..8df37ecbc0 100644 --- a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java +++ b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java @@ -221,7 +221,15 @@ public Review saveReview(ReviewDto dto) { int numberOfReviews = reviewRepository.countByReceiverUserId(receiver.getUserId()); double oldCoffeeBean = receiver.getCoffeeBean(); - double newCoffeeBean = oldCoffeeBean + (dto.getRating() * 0.1) * numberOfReviews; + + double baseline = 46.0; + double ratio = 0.1; + double standard = 4.0; + + // 46 + (평점 합계 + (새로운 평점 - 기준 평점) * 반영 비율) / (평점 개수 + 1) + double newCoffeeBean = + baseline + ((oldCoffeeBean - baseline) * numberOfReviews + (dto.getRating() - standard) * ratio) / + (numberOfReviews + 1); receiver.setCoffeeBean(newCoffeeBean); userRepository.save(receiver);