当前位置: 首页>>代码示例>>Python>>正文


Python Event.category_chain_overlaps方法代码示例

本文整理汇总了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))
开发者ID:OmeGak,项目名称:indico,代码行数:18,代码来源:util.py

示例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
开发者ID:indico,项目名称:indico-plugins,代码行数:38,代码来源:simplify.py


注:本文中的indico.modules.events.models.events.Event.category_chain_overlaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。