forked from organicmaps/organicmaps
[search] Get the minutes until open/closed for the search results
Signed-off-by: David Martinez <47610359+dvdmrtnz@users.noreply.github.com>
This commit is contained in:
parent
48b11d9e12
commit
4071ef5adf
2 changed files with 11 additions and 1 deletions
|
@ -248,8 +248,12 @@ void FillDetails(FeatureType & ft, Result::Details & details)
|
|||
/// @todo We should check closed/open time for specific feature's timezone.
|
||||
time_t const now = time(nullptr);
|
||||
if (oh.IsValid() && !oh.IsUnknown(now))
|
||||
{
|
||||
details.m_isOpenNow = oh.IsOpen(now) ? osm::Yes : osm::No;
|
||||
// In else case value us osm::Unknown, it's set in preview's constructor.
|
||||
// In else case value is osm::Unknown, it's set in preview's constructor.
|
||||
details.m_minutesUntilOpen = (oh.GetNextTimeOpen(now) - now) / 60;
|
||||
details.m_minutesUntilClosed = (oh.GetNextTimeClosed(now) - now) / 60;
|
||||
}
|
||||
}
|
||||
|
||||
if (strings::to_uint(ft.GetMetadata(feature::Metadata::FMD_STARS), details.m_stars))
|
||||
|
|
|
@ -65,6 +65,10 @@ public:
|
|||
// Valid for any result.
|
||||
osm::YesNoUnknown m_isOpenNow = osm::Unknown;
|
||||
|
||||
uint16_t m_minutesUntilOpen = 0;
|
||||
|
||||
uint16_t m_minutesUntilClosed = 0;
|
||||
|
||||
bool m_isInitialized = false;
|
||||
};
|
||||
|
||||
|
@ -98,6 +102,8 @@ public:
|
|||
bool IsHotel() const { return m_details.m_isHotel; }
|
||||
|
||||
osm::YesNoUnknown IsOpenNow() const { return m_details.m_isOpenNow; }
|
||||
uint16_t GetMinutesUntilOpen() const { return m_details.m_minutesUntilOpen; }
|
||||
uint16_t GetMinutesUntilClosed() const { return m_details.m_minutesUntilClosed; }
|
||||
int GetStarsCount() const { return m_details.m_stars; }
|
||||
|
||||
bool IsSuggest() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue