本文整理汇总了Python中indico.modules.events.models.events.Event.category_chain_overlaps方法的典型用法代码示例。如果您正苦于以下问题:Python Event.category_chain_overlaps方法的具体用法?Python Event.category_chain_overlaps怎么用?Python Event.category_chain_overlaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.events.models.events.Event
的用法示例。
在下文中一共展示了Event.category_chain_overlaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _query_events
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import category_chain_overlaps [as 别名]
def _query_events(categ_ids, day_start, day_end):
event = db.aliased(Event)
dates_overlap = lambda t: (t.start_dt >= day_start) & (t.start_dt <= day_end)
return (db.session.query(Event.id, TimetableEntry.start_dt)
.filter(
Event.category_chain_overlaps(categ_ids),
~Event.is_deleted,
((Event.timetable_entries.any(dates_overlap(TimetableEntry))) |
(Event.query.exists().where(
Event.happens_between(day_start, day_end) &
(Event.id == event.id)))))
.group_by(Event.id, TimetableEntry.start_dt)
.order_by(Event.id, TimetableEntry.start_dt)
.join(TimetableEntry,
(TimetableEntry.event_id == Event.id) & (dates_overlap(TimetableEntry)),
isouter=True))
示例2: _process_cascaded_category_contents
# 需要导入模块: from indico.modules.events.models.events import Event [as 别名]
# 或者: from indico.modules.events.models.events.Event import category_chain_overlaps [as 别名]
def _process_cascaded_category_contents(records):
"""
Travel from categories to subcontributions, flattening the whole event structure.
Yields everything that it finds (except for elements whose protection has changed
but are not inheriting their protection settings from anywhere).
:param records: queue records to process
"""
category_prot_records = {rec.category_id for rec in records if rec.type == EntryType.category
and rec.change == ChangeType.protection_changed}
category_move_records = {rec.category_id for rec in records if rec.type == EntryType.category
and rec.change == ChangeType.moved}
changed_events = set()
category_prot_records -= category_move_records # A move already implies sending the whole record
# Protection changes are handled differently, as there may not be the need to re-generate the record
if category_prot_records:
for categ in Category.find(Category.id.in_(category_prot_records)):
cte = categ.get_protection_parent_cte()
# Update only children that inherit
inheriting_categ_children = (Event.query
.join(cte, db.and_((Event.category_id == cte.c.id),
(cte.c.protection_parent == categ.id))))
inheriting_direct_children = Event.find((Event.category_id == categ.id) & Event.is_inheriting)
changed_events.update(itertools.chain(inheriting_direct_children, inheriting_categ_children))
# Add move operations and explicitly-passed event records
if category_move_records:
changed_events.update(Event.find(Event.category_chain_overlaps(category_move_records)))
for elem in _process_cascaded_event_contents(records, additional_events=changed_events):
yield elem