本文整理汇总了Python中fedocal.fedocallib.model.Meeting.get_overlaping_meetings方法的典型用法代码示例。如果您正苦于以下问题:Python Meeting.get_overlaping_meetings方法的具体用法?Python Meeting.get_overlaping_meetings怎么用?Python Meeting.get_overlaping_meetings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fedocal.fedocallib.model.Meeting
的用法示例。
在下文中一共展示了Meeting.get_overlaping_meetings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: agenda_is_free
# 需要导入模块: from fedocal.fedocallib.model import Meeting [as 别名]
# 或者: from fedocal.fedocallib.model.Meeting import get_overlaping_meetings [as 别名]
def agenda_is_free(
session, calendarobj,
meeting_date,
meeting_date_end):
"""Check if there is already someting planned in this agenda at that
time on that day.
:arg session: the database session to use
:arg calendar: the name of the calendar of interest.
:arg meeting_date: the date of the meeting (as Datetime object)
:arg meeting_date_end: the end date of the meeting (as Datetime
object)
:arg time_start: the time at which the meeting starts (as int)
:arg time_stop: the time at which the meeting stops (as int)
"""
meetings = Meeting.get_overlaping_meetings(
session, calendarobj,
meeting_date.date(),
meeting_date_end.date())
agenda_free = True
for meeting in set(meetings):
meeting_start_date_time = datetime(
meeting.meeting_date.year,
meeting.meeting_date.month,
meeting.meeting_date.day,
meeting.meeting_time_start.hour,
meeting.meeting_time_start.minute,
tzinfo=pytz.timezone(meeting.meeting_timezone))
meeting_stop_date_time = datetime(
meeting.meeting_date_end.year,
meeting.meeting_date_end.month,
meeting.meeting_date_end.day,
meeting.meeting_time_stop.hour,
meeting.meeting_time_stop.minute,
tzinfo=pytz.timezone(meeting.meeting_timezone))
if meeting_date <= meeting_start_date_time \
and meeting_date_end > meeting_start_date_time:
agenda_free = False
elif meeting_date < meeting_stop_date_time \
and meeting_date_end >= meeting_stop_date_time:
agenda_free = False
elif meeting_date < meeting_start_date_time \
and meeting_date_end > meeting_stop_date_time:
agenda_free = False
elif meeting_date > meeting_start_date_time \
and meeting_date_end < meeting_stop_date_time:
agenda_free = False
elif meeting_date == meeting_start_date_time \
and meeting_date_end == meeting_stop_date_time:
agenda_free = False
return agenda_free