Subversion Repositories SmartDukaan

Rev

Rev 5871 | Rev 5879 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5871 Rev 5874
Line 1551... Line 1551...
1551
    orders placed with us. No need to consider reshippped orders for min/max
1551
    orders placed with us. No need to consider reshippped orders for min/max
1552
    amount of orders.
1552
    amount of orders.
1553
    '''
1553
    '''
1554
    return session.query(func.min(Order.total_amount), func.max(Order.total_amount)).filter(Order.status >= OrderStatus.SUBMITTED_FOR_PROCESSING).one()
1554
    return session.query(func.min(Order.total_amount), func.max(Order.total_amount)).filter(Order.status >= OrderStatus.SUBMITTED_FOR_PROCESSING).one()
1555
 
1555
 
1556
def get_valid_orders(limit):
1556
def get_valid_orders(limit, onlyStore):
1557
    '''
1557
    '''
1558
    Returns the last limit number of valid orders placed with us. Ignored the
1558
    Returns the last limit number of valid orders placed with us. Ignored the
1559
    limit if it's passed as 0. Raises an excpetion if the supplied limit is 
1559
    limit if it's passed as 0. Raises an excpetion if the supplied limit is 
1560
    less than 0. 
1560
    less than 0. 
1561
    '''
1561
    '''
1562
    if limit < 0:
1562
    if limit < 0:
1563
        raise TransactionServiceException(101, "Invalid argument limit " + limit)
1563
        raise TransactionServiceException(101, "Invalid argument limit " + limit)
1564
    query = Order.query.filter(Order.status >= OrderStatus.COD_VERIFICATION_PENDING)
1564
    query = Order.query.filter(Order.status >= OrderStatus.COD_VERIFICATION_PENDING)
-
 
1565
    if onlyStore:
-
 
1566
        query = query.filter(Order.pickupStoreId != 0)
1565
    query = query.order_by(desc(Order.created_timestamp))
1567
    query = query.order_by(desc(Order.created_timestamp))
1566
    if limit != 0:
1568
    if limit != 0:
1567
        query = query.limit(limit)
1569
        query = query.limit(limit)
1568
    return query.all()
1570
    return query.all()
1569
 
1571