From 6905147c631e72caf4a47bd29d56ead0dac62b86 Mon Sep 17 00:00:00 2001 From: Alexander Boriskov Date: Fri, 21 Feb 2020 18:49:23 +0300 Subject: [PATCH] [iOS] Fixed hotel raiting in pp https://jira.mail.ru/browse/MAPSME-13139 --- .../PlacePagePreviewViewController.swift | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePagePreviewViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePagePreviewViewController.swift index 0b94c75176..0cdc257069 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePagePreviewViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePagePreviewViewController.swift @@ -124,9 +124,24 @@ class PlacePagePreviewViewController: UIViewController { } func updateBooking(_ bookingData: HotelBookingData, rooms: HotelRooms?) { + var rawRating: Int + switch bookingData.score { + case 0..<2: + rawRating = 1 + case 2..<4: + rawRating = 2 + case 4..<6: + rawRating = 3 + case 6..<8: + rawRating = 4 + case 8...10: + rawRating = 5 + default: + rawRating = 0 + } + ugcContainerView.isHidden = false ratingSummaryView.value = NSNumber(value: bookingData.score).stringValue - let rawRating = Int(bookingData.score / 2) + 1 ratingSummaryView.type = UgcSummaryRatingType(rawValue: rawRating) ?? .none guard let rooms = rooms else { return } priceLabel.text = String(coreFormat: L("place_page_starting_from"), arguments: [rooms.minPrice])