Example #1
0
def queuelog_exists_record(log):
    if isinstance(log, list):  # improveme later...sure
        log = parse_list_record(log)

    return session_db.query(exists().where(QueueLog.time == log['time']).where(
        QueueLog.event == log['event']).where(
            QueueLog.queuename == log['queuename']).where(
                QueueLog.callid == log['callid'])).scalar()
Example #2
0
def queuelog_exists_record(log):
    if isinstance(log, list):  # improveme later...sure
        log = parse_list_record(log)

    return session_db.query(
               exists().where(QueueLog.time == log['time']).
               where(QueueLog.event == log['event']).
               where(QueueLog.queuename == log['queuename']).
               where(QueueLog.callid == log['callid'])
           ).scalar()
Example #3
0
def queuelog_event_by_range_and_types(start_date, end_date, events=None,
                                      agent=None, queue=None):
    try:
        q = session_db.query(QueueLog)
        if start_date:
            q = q.filter(QueueLog.time >= start_date)
        if end_date:
            q = q.filter(QueueLog.time <= end_date)
        if events:
            q = q.filter(QueueLog.event.in_(events))
        if agent:
            q = q.filter(QueueLog.agent.in_(agent))
        if queue:
            q = q.filter(QueueLog.queuename == queue)
        return q.order_by(QueueLog.id.asc()).all()
    except NoResultFound, e:
        print(e)
        return None
Example #4
0
def queuelog_event_by_range_and_types(start_date,
                                      end_date,
                                      events=None,
                                      agent=None,
                                      queue=None):
    try:
        q = session_db.query(QueueLog)
        if start_date:
            q = q.filter(QueueLog.time >= start_date)
        if end_date:
            q = q.filter(QueueLog.time <= end_date)
        if events:
            q = q.filter(QueueLog.event.in_(events))
        if agent:
            q = q.filter(QueueLog.agent.in_(agent))
        if queue:
            q = q.filter(QueueLog.queuename == queue)
        return q.order_by(QueueLog.id.asc()).all()
    except NoResultFound, e:
        print(e)
        return None