File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
application-client/src/main/kotlin/org/fastcampus/applicationclient/store/mapper Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ object StoreMapper {
5555 id = id ? : " unknown" ,
5656 name = name ? : " unknown" ,
5757 imageMain = imageMain ? : " unknown" ,
58- rating = rating?.toDouble() ? : 0.0 , // null이면 0.0 반환
58+ rating = roundedRating(rating) , // null이면 0.0 반환
5959 reviewCount = reviewCount ? : 0 ,
6060 deliveryTime = distance.calculateDeliveryTime().toString(),
6161 deliveryDistance = distance,
@@ -67,6 +67,13 @@ object StoreMapper {
6767 minimumOrderAmount = minimumOrderAmount,
6868 )
6969
70+ private fun roundedRating (rating : Float? ): Double {
71+ val rawRating = rating?.toDouble() ? : 0.0
72+ // 소수점 한 자리까지 반올림
73+ val roundedRating = Math .round(rawRating * 10 ) / 10.0
74+ return roundedRating
75+ }
76+
7077 private fun Menu.toMenuResponse (): MenuOptionInfo {
7178 return MenuOptionInfo (
7279 id = this .id ? : " unknown" ,
You can’t perform that action at this time.
0 commit comments