Fixed local experts showing and added rating rescaling

This commit is contained in:
r.kuznetsov 2017-12-06 18:51:44 +03:00 committed by Ilya Grechuhin
parent 0d6769e95d
commit c6c151b3bd
3 changed files with 10 additions and 2 deletions

View file

@ -21,7 +21,11 @@ final class DiscoveryLocalExpertCell: UICollectionViewCell {
price: Double,
currency: String,
tap: @escaping Tap) {
avatar.af_setImage(withURL: URL(string: avatarURL)!)
if avatarURL.count > 0 {
avatar.af_setImage(withURL: URL(string: avatarURL)!, imageTransition: .crossDissolve(kDefaultAnimationDuration))
} else {
avatar.image = nil
}
self.name.text = name
rating.value = ratingValue
rating.type = ratingType

View file

@ -118,7 +118,7 @@ struct Callback
auto getTypes = [](MWMDiscoveryMode m) -> vector<ItemType> {
if (m == MWMDiscoveryModeOnline)
return {ItemType::Viator, ItemType::Attractions, ItemType::Cafes};
return {ItemType::Viator, ItemType::Attractions, ItemType::Cafes, ItemType::LocalExperts};
return {ItemType::Attractions, ItemType::Cafes};
};

View file

@ -70,6 +70,10 @@ void ParseLocals(std::string const & src, std::vector<LocalExpert> & locals,
FromJSONObject(item, "currency", local.m_currency);
FromJSONObject(item, "about_me", local.m_aboutExpert);
FromJSONObject(item, "i_will_show_you", local.m_offerDescription);
// Rescale rating to [0.0; 10.0] range.
local.m_rating *= 2;
locals.push_back(move(local));
}
}