Subversion Repositories SmartDukaan

Rev

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

Rev 20350 Rev 20351
Line 672... Line 672...
672
    '''
672
    '''
673
    Returns the query to be used for getting Best Sellers.
673
    Returns the query to be used for getting Best Sellers.
674
    Ignores the category if it's passed as -1 and the brand if it's passed as None.
674
    Ignores the category if it's passed as -1 and the brand if it's passed as None.
675
    '''
675
    '''
676
    #query = Item.query.filter_by(status=status.ACTIVE).filter(Item.bestSellingRank != None)
676
    #query = Item.query.filter_by(status=status.ACTIVE).filter(Item.bestSellingRank != None)
677
    query = Item.query.filter_by(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).filter(Item.bestSellingRank != None)
677
    query = Item.query.filter(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).filter(Item.bestSellingRank != None)
678
    if category != -1:
678
    if category != -1:
679
        all_categories = [category]
679
        all_categories = [category]
680
        child_categories = get_child_categories(category)
680
        child_categories = get_child_categories(category)
681
        if child_categories is not None:
681
        if child_categories is not None:
682
            all_categories = all_categories + child_categories
682
            all_categories = all_categories + child_categories
Line 717... Line 717...
717
    '''
717
    '''
718
    Returns the query to be used to select the best deals in the given brand and category.
718
    Returns the query to be used to select the best deals in the given brand and category.
719
    Ignores the category if it's passed as -1 and the brand if it's passed as None.
719
    Ignores the category if it's passed as -1 and the brand if it's passed as None.
720
    '''
720
    '''
721
    #query = session.query(obj).filter_by(status=status.ACTIVE).filter(Item.bestDealValue != None)
721
    #query = session.query(obj).filter_by(status=status.ACTIVE).filter(Item.bestDealValue != None)
722
    query = session.query(obj).filter_by(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).filter(Item.bestDealValue != None)
722
    query = session.query(obj).filter(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).filter(Item.bestDealValue != None)
723
    if category != -1:
723
    if category != -1:
724
        all_categories = [category]
724
        all_categories = [category]
725
        child_categories = get_child_categories(category)
725
        child_categories = get_child_categories(category)
726
        if child_categories is not None:
726
        if child_categories is not None:
727
            all_categories = all_categories + child_categories
727
            all_categories = all_categories + child_categories
Line 828... Line 828...
828
def get_latest_arrivals_counting_query(obj, categories, brand):
828
def get_latest_arrivals_counting_query(obj, categories, brand):
829
    '''
829
    '''
830
    Returns the query to be used to count Latest arrivals.
830
    Returns the query to be used to count Latest arrivals.
831
    To ignore the categories, pass the list as empty. To ignore brand, pass it as null.
831
    To ignore the categories, pass the list as empty. To ignore brand, pass it as null.
832
    '''
832
    '''
833
    query = session.filter_by(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).query(obj)
833
    query = session.filter(Item.status.in_([status.ACTIVE, status.PAUSED_BY_RISK])).query(obj)
834
    #query = session.query(obj).filter_by(status=status.ACTIVE)
834
    #query = session.query(obj).filter_by(status=status.ACTIVE)
835
   
835
   
836
    all_categories = []
836
    all_categories = []
837
    for category in categories:
837
    for category in categories:
838
        all_categories.append(category)
838
        all_categories.append(category)