[booking] Overwriting of unavailability reason is supported.

This commit is contained in:
Arsentiy Milchakov 2020-08-04 12:21:23 +03:00 committed by Anatoliy V. Tomilov
parent fb35c2cb62
commit 713cf65335
4 changed files with 11 additions and 11 deletions

View file

@ -54,7 +54,7 @@ void SortTransform(search::Results const & results, std::vector<Extras> const &
}
}
void AppendUnavailable(search::Results const & filteredOut, SearchMarks & searchMarks)
void SetUnavailable(search::Results const & filteredOut, SearchMarks & searchMarks)
{
if (filteredOut.GetCount() == 0)
return;
@ -62,11 +62,11 @@ void AppendUnavailable(search::Results const & filteredOut, SearchMarks & search
std::string reason = platform::GetLocalizedString("booking_map_component_availability");
for (auto const & filtered : filteredOut)
{
searchMarks.AppendUnavailable(filtered.GetFeatureID(), reason);
searchMarks.SetUnavailable(filtered.GetFeatureID(), reason);
}
}
void AppendUnavailable(std::vector<FeatureID> const & filteredOut, SearchMarks & searchMarks)
void SetUnavailable(std::vector<FeatureID> const & filteredOut, SearchMarks & searchMarks)
{
if (filteredOut.empty())
return;
@ -74,7 +74,7 @@ void AppendUnavailable(std::vector<FeatureID> const & filteredOut, SearchMarks &
std::string reason = platform::GetLocalizedString("booking_map_component_availability");
for (auto const & filtered : filteredOut)
{
searchMarks.AppendUnavailable(filtered, reason);
searchMarks.SetUnavailable(filtered, reason);
}
}
} // namespace
@ -102,7 +102,7 @@ filter::TasksInternal MakeInternalTasks(search::Results const & results,
[results, &searchMarks, type, apiParams, cb, inViewport](ResultInternal<search::Results> && result)
{
if (type == Type::Availability)
AppendUnavailable(result.m_filteredOut, searchMarks);
SetUnavailable(result.m_filteredOut, searchMarks);
auto & filteredResults = result.m_passedFilter;
auto & extras = result.m_extras;
@ -170,7 +170,7 @@ filter::TasksRawInternal MakeInternalTasks(std::vector<FeatureID> const & featur
[features, &searchMarks, type, apiParams, cb](ResultInternal<std::vector<FeatureID>> && result)
{
if (type == Type::Availability)
AppendUnavailable(result.m_filteredOut, searchMarks);
SetUnavailable(result.m_filteredOut, searchMarks);
auto & sortedFeatures = result.m_passedFilter;
auto & extras = result.m_extras;

View file

@ -1832,7 +1832,7 @@ void Framework::FillSearchResultsMarks(search::Results::ConstIter begin,
if (!reason)
reason = platform::GetLocalizedString("booking_map_component_filters");
m_searchMarks.AppendUnavailable(mark->GetFeatureID(), *reason);
m_searchMarks.SetUnavailable(mark->GetFeatureID(), *reason);
}
if (r.m_details.m_isSponsoredHotel)
@ -3988,7 +3988,7 @@ void Framework::ShowViewportSearchResults(search::Results const & results, bool
auto const isFilteredOut = binary_search(filteredOut.cbegin(), filteredOut.cend(), id);
if (isFilteredOut)
m_searchMarks.AppendUnavailable(mark.GetFeatureID(), reason);
m_searchMarks.SetUnavailable(mark.GetFeatureID(), reason);
}
break;

View file

@ -744,9 +744,9 @@ void SearchMarks::ClearUsed()
m_used.clear();
}
void SearchMarks::AppendUnavailable(FeatureID const & id, std::string const & reason)
void SearchMarks::SetUnavailable(FeatureID const & id, std::string const & reason)
{
m_unavailable.try_emplace(id, reason);
m_unavailable[id] = reason;
}
bool SearchMarks::IsUnavailable(FeatureID const & id) const

View file

@ -120,7 +120,7 @@ public:
bool IsUsed(FeatureID const & id) const;
void ClearUsed();
void AppendUnavailable(FeatureID const & id, std::string const & reason);
void SetUnavailable(FeatureID const & id, std::string const & reason);
bool IsUnavailable(FeatureID const & id) const;
void MarkUnavailableIfNeeded(SearchMarkPoint * mark) const;
void ClearUnavailable();