Пример #1
0
def add_reader_category_filter(query, category, joined_entities):
    """
    Modifies query to filter by reader type.

    :param query: The query to further filter.
    :param category: The category type.
    :param joined_entities: Which entities have already been joined in the query.
                            Reader filters may require additional joins.  This
                            list will be modified if an additional join is made.
    :return: query (side-effected)
    """
    if Box2 not in joined_entities:
        query = query.join(Box2)

    if category == READER_PRODUCTION:
        query = query.filter(Box2.prod_query()).filter(Box2.reference != True)
    #elif category == READER_GROOVE:
    #    query = query.filteR(Box2.code.in_())
    elif category == READER_LAB:
        query = query.filter(Box2.lab_query())
    elif category == READER_GOLDEN_DR:
        query = query.filter(Box2.reference == True)
    elif category == READER_FLUIDICS_MODULES:
        query = query.filter(Box2.fluidics_module_query())
    elif category == READER_DETECTOR_MODULES:
        query = query.filter(Box2.detector_module_query())
    elif category == READER_QX100:
        query = query.filter(SystemVersion.type == 'QX100')
    elif category == READER_QX150:
        query = query.filter(SystemVersion.type == 'QX150')
    elif category == READER_QX200:
        query = query.filter(SystemVersion.type == 'QX200')
    return query
Пример #2
0
 def __fluidics_modules(self):
     fm_query = Session.query(Box2).filter(Box2.fluidics_module_query()).order_by('name desc')
     box2s = fm_query.all()
     return box2s