From af1d5e8284d709652cdb26d7d6fe8945c76d2d61 Mon Sep 17 00:00:00 2001 From: brinst07 Date: Thu, 6 Mar 2025 21:23:36 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EB=B0=98=EC=98=AC=EB=A6=BC=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applicationclient/store/mapper/StoreMapper.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/application-client/src/main/kotlin/org/fastcampus/applicationclient/store/mapper/StoreMapper.kt b/application-client/src/main/kotlin/org/fastcampus/applicationclient/store/mapper/StoreMapper.kt index a9b91b7..32a939f 100644 --- a/application-client/src/main/kotlin/org/fastcampus/applicationclient/store/mapper/StoreMapper.kt +++ b/application-client/src/main/kotlin/org/fastcampus/applicationclient/store/mapper/StoreMapper.kt @@ -55,7 +55,7 @@ object StoreMapper { id = id ?: "unknown", name = name ?: "unknown", imageMain = imageMain ?: "unknown", - rating = rating?.toDouble() ?: 0.0, // null이면 0.0 반환 + rating = roundedRating(rating), // null이면 0.0 반환 reviewCount = reviewCount ?: 0, deliveryTime = distance.calculateDeliveryTime().toString(), deliveryDistance = distance, @@ -67,6 +67,13 @@ object StoreMapper { minimumOrderAmount = minimumOrderAmount, ) + private fun roundedRating(rating: Float?): Double { + val rawRating = rating?.toDouble() ?: 0.0 + // 소수점 한 자리까지 반올림 + val roundedRating = Math.round(rawRating * 10) / 10.0 + return roundedRating + } + private fun Menu.toMenuResponse(): MenuOptionInfo { return MenuOptionInfo( id = this.id ?: "unknown",