[iOS] fix review info on place page

This commit is contained in:
Aleksey Belouosv 2018-10-05 16:30:59 +03:00 committed by Daria Volvenkova
parent 5e37af753c
commit e2cac6a202
5 changed files with 10 additions and 12 deletions

View file

@ -533,7 +533,7 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
auto c = static_cast<MWMUGCSummaryRatingCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
auto ugc = data.ugc;
[c configWithReviewsCount:[ugc totalReviewsCount]
[c configWithReviewsCount:[ugc numberOfRatings]
summaryRating:[ugc summaryRating]
ratings:[ugc ratings]];
return c;

View file

@ -239,6 +239,7 @@ std::array<Class, 9> const kPreviewCells = {{[_MWMPPPTitle class],
canAddReview:NO
isReviewedByUser:NO
reviewsCount:0
ratingsCount:0
price:data.bookingPricing
discount:data.bookingDiscount
smartDeal:data.isSmartDeal
@ -253,7 +254,8 @@ std::array<Class, 9> const kPreviewCells = {{[_MWMPPPTitle class],
[reviewCell configWithRating:data.ugc.summaryRating
canAddReview:YES
isReviewedByUser:!data.ugc.isUGCUpdateEmpty
reviewsCount:data.ugc.totalReviewsCount
reviewsCount:data.ugc.numberOfReviews
ratingsCount:data.ugc.numberOfRatings
price:@""
discount:0
smartDeal:NO

View file

@ -34,6 +34,7 @@ final class PPPReview: MWMTableViewCell {
canAddReview: Bool,
isReviewedByUser: Bool,
reviewsCount: UInt,
ratingsCount: UInt,
price: String,
discount: Int,
smartDeal: Bool,
@ -74,18 +75,13 @@ final class PPPReview: MWMTableViewCell {
} else {
ratingSummaryView.noValueImage = #imageLiteral(resourceName: "ic_12px_rating_normal")
ratingSummaryView.noValueColor = UIColor.blackSecondaryText()
reviewsLabel.text = L("placepage_no_reviews")
reviewsLabel.text = reviewsCount == 0 ? L("placepage_no_reviews") : ""
}
} else {
ratingSummaryView.defaultConfig()
if reviewsCount > 0 {
reviewsLabel.text = String(format:L("placepage_summary_rating_description"), reviewsCount)
reviewsLabel.isHidden = false
} else {
reviewsLabel.text = ""
reviewsLabel.isHidden = true
}
reviewsLabel.text = ratingsCount > 0
? String(format:L("placepage_summary_rating_description"), ratingsCount) : ""
pricingLabel.isHidden = false
}
}

View file

@ -42,7 +42,7 @@ enum class ReviewRow
- (NSUInteger)addReviewCellsCount;
- (std::vector<ugc::view_model::ReviewRow> const &)reviewRows;
- (NSUInteger)totalReviewsCount;
- (NSUInteger)numberOfRatings;
- (MWMUGCRatingValueType *)summaryRating;
- (NSArray<MWMUGCRatingStars *> *)ratings;

View file

@ -79,7 +79,7 @@ MWMUGCRatingValueType * ratingValueType(float rating)
- (BOOL)isAggregatedRatingEmpty { return m_ugc.m_totalRating == kIncorrectRating; }
- (NSUInteger)ratingCellsCount { return 1; }
- (NSUInteger)addReviewCellsCount { return 1; }
- (NSUInteger)totalReviewsCount { return static_cast<NSUInteger>(m_ugc.m_basedOn); }
- (NSUInteger)numberOfRatings { return static_cast<NSUInteger>(m_ugc.m_basedOn); }
- (MWMUGCRatingValueType *)summaryRating { return ratingValueType(m_ugc.m_totalRating); }
- (NSArray<MWMUGCRatingStars *> *)ratings { return starsRatings(m_ugc.m_ratings); }
- (std::vector<ugc::view_model::ReviewRow> const &)reviewRows { return m_reviewRows; }