forked from organicmaps/organicmaps
[booking] priority of unavailability by online filters is increased.
This commit is contained in:
parent
713cf65335
commit
5c80cf33bf
3 changed files with 18 additions and 13 deletions
|
@ -63,8 +63,7 @@ using HotelToFeatureIds = HotelsMapping<FeatureID>;
|
|||
|
||||
bool IsConformToFilter(search::Result const & r)
|
||||
{
|
||||
return r.m_details.m_isSponsoredHotel && r.GetResultType() == search::Result::Type::Feature &&
|
||||
!r.IsRefusedByFilter();
|
||||
return r.m_details.m_isSponsoredHotel && r.GetResultType() == search::Result::Type::Feature;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -25,10 +25,12 @@ void SortTransform(search::Results const & results, std::vector<Extras> const &
|
|||
CHECK_EQUAL(results.GetCount(), extras.size(), ());
|
||||
|
||||
std::vector<std::pair<FeatureID, std::string>> featuresWithPrices;
|
||||
featuresWithPrices.reserve(results.GetCount());
|
||||
PriceFormatter formatter;
|
||||
for (size_t i = 0; i < results.GetCount(); ++i)
|
||||
{
|
||||
if (results[i].IsRefusedByFilter())
|
||||
continue;
|
||||
|
||||
auto priceFormatted = formatter.Format(extras[i].m_price, extras[i].m_currency);
|
||||
featuresWithPrices.emplace_back(results[i].GetFeatureID(), std::move(priceFormatted));
|
||||
}
|
||||
|
@ -180,18 +182,19 @@ filter::TasksRawInternal MakeInternalTasks(std::vector<FeatureID> const & featur
|
|||
if (sortedFeatures.empty())
|
||||
return;
|
||||
|
||||
std::vector<std::string> orderedPrices;
|
||||
orderedPrices.reserve(extras.size());
|
||||
PriceFormatter formatter;
|
||||
for (size_t i = 0; i < extras.size(); ++i)
|
||||
orderedPrices.emplace_back(formatter.Format(extras[i].m_price, extras[i].m_currency));
|
||||
CHECK_EQUAL(sortedFeatures.size(), extras.size(), ());
|
||||
|
||||
PriceFormatter formatter;
|
||||
std::vector<FeatureID> sortedAvailable;
|
||||
for (auto & id : sortedFeatures)
|
||||
std::vector<std::string> orderedPrices;
|
||||
for (size_t i = 0; i < sortedFeatures.size(); ++i)
|
||||
{
|
||||
// Some hotels might be unavailable by offline filter.
|
||||
if (!searchMarks.IsUnavailable(id))
|
||||
sortedAvailable.emplace_back(std::move(id));
|
||||
if (searchMarks.IsUnavailable(sortedFeatures[i]))
|
||||
continue;
|
||||
|
||||
sortedAvailable.emplace_back(std::move(sortedFeatures[i]));
|
||||
orderedPrices.emplace_back(formatter.Format(extras[i].m_price, extras[i].m_currency));
|
||||
}
|
||||
|
||||
GetPlatform().RunTask(Platform::Thread::Gui, [&searchMarks, type, sortedAvailable,
|
||||
|
|
|
@ -3970,9 +3970,12 @@ void Framework::ShowViewportSearchResults(search::Results const & results, bool
|
|||
mark.SetSale(found);
|
||||
break;
|
||||
case Type::Availability:
|
||||
mark.SetPreparing(!found);
|
||||
// Some hotels might be unavailable by offline filters.
|
||||
auto const isAvailable = found && !m_searchMarks.IsUnavailable(id);
|
||||
|
||||
if (found && !filterResult.m_extras.empty())
|
||||
mark.SetPreparing(!isAvailable);
|
||||
|
||||
if (isAvailable && !filterResult.m_extras.empty())
|
||||
{
|
||||
auto const index = distance(features.cbegin(), it);
|
||||
auto price = formatter.Format(filterResult.m_extras[index].m_price,
|
||||
|
|
Loading…
Add table
Reference in a new issue