Split business opening hours by week days.
This commit is contained in:
parent
64094e17c0
commit
52d9ac02ba
@ -631,7 +631,7 @@ businessOpeningHours time_zone_id:string opening_hours:vector<businessOpeningHou
|
|||||||
|
|
||||||
//@description Contains information about a Telegram Business account
|
//@description Contains information about a Telegram Business account
|
||||||
//@location Location of the business; may be null if none
|
//@location Location of the business; may be null if none
|
||||||
//@opening_hours Opening hours of the business; may be null if none
|
//@opening_hours Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days
|
||||||
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
||||||
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
||||||
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
|
businessInfo location:businessLocation opening_hours:businessOpeningHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
|
||||||
|
@ -54,10 +54,18 @@ td_api::object_ptr<td_api::businessOpeningHours> BusinessWorkHours::get_business
|
|||||||
if (is_empty()) {
|
if (is_empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return td_api::make_object<td_api::businessOpeningHours>(
|
vector<td_api::object_ptr<td_api::businessOpeningHoursInterval>> intervals;
|
||||||
time_zone_id_, transform(work_hours_, [](const WorkHoursInterval &interval) {
|
for (const auto &work_hour : work_hours_) {
|
||||||
return interval.get_business_opening_hours_interval_object();
|
auto interval = work_hour;
|
||||||
}));
|
while (interval.start_minute_ / (24 * 60) + 1 < interval.end_minute_ / (24 * 60)) {
|
||||||
|
auto prefix = interval;
|
||||||
|
prefix.end_minute_ = (interval.start_minute_ / (24 * 60) + 1) * 24 * 60;
|
||||||
|
interval.start_minute_ = prefix.end_minute_;
|
||||||
|
intervals.push_back(prefix.get_business_opening_hours_interval_object());
|
||||||
|
}
|
||||||
|
intervals.push_back(interval.get_business_opening_hours_interval_object());
|
||||||
|
}
|
||||||
|
return td_api::make_object<td_api::businessOpeningHours>(time_zone_id_, std::move(intervals));
|
||||||
}
|
}
|
||||||
|
|
||||||
telegram_api::object_ptr<telegram_api::businessWorkHours> BusinessWorkHours::get_input_business_work_hours() const {
|
telegram_api::object_ptr<telegram_api::businessWorkHours> BusinessWorkHours::get_input_business_work_hours() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user