本文整理匯總了Python中fedocal.fedocallib.model.Meeting.get_meeting_with_reminder方法的典型用法代碼示例。如果您正苦於以下問題:Python Meeting.get_meeting_with_reminder方法的具體用法?Python Meeting.get_meeting_with_reminder怎麽用?Python Meeting.get_meeting_with_reminder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fedocal.fedocallib.model.Meeting
的用法示例。
在下文中一共展示了Meeting.get_meeting_with_reminder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: retrieve_meeting_to_remind
# 需要導入模塊: from fedocal.fedocallib.model import Meeting [as 別名]
# 或者: from fedocal.fedocallib.model.Meeting import get_meeting_with_reminder [as 別名]
def retrieve_meeting_to_remind(session, offset=30):
""" Retrieve all the meetings for which we have to send a reminder.
:arg session: the database session to use.
:kwarg offset: the frequency at which the cron job is ran in order
to avoid sending twice the same reminder.
"""
today = datetime.utcnow()
meetings = []
for reminder_time in [12, 24, 48, 168]:
# Retrieve meeting planned in less than X hours
new_date = _generate_date_rounded_to_the_hour(today,
reminder_time)
end_date = new_date + timedelta(minutes=offset)
if new_date.date() != end_date.date():
# in case the end_date is day after (ie: 23:45 + 30min), make
# the end_date as start_date at 23:59
end_date = datetime(
new_date.year, new_date.month, new_date.day, 23, 59)
meetings.extend(Meeting.get_meeting_with_reminder(
session, new_date.date(), new_date.time(), end_date.time(),
'H-%s' % reminder_time))
return meetings