| Line 671... |
Line 671... |
| 671 |
def get_best_sellers_query(category, brand):
|
671 |
def get_best_sellers_query(category, brand):
|
| 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(Item.bestSellingRank != None)
|
| 677 |
if category != -1:
|
678 |
if category != -1:
|
| 678 |
all_categories = [category]
|
679 |
all_categories = [category]
|
| 679 |
child_categories = get_child_categories(category)
|
680 |
child_categories = get_child_categories(category)
|
| 680 |
if child_categories is not None:
|
681 |
if child_categories is not None:
|
| 681 |
all_categories = all_categories + child_categories
|
682 |
all_categories = all_categories + child_categories
|
| Line 715... |
Line 716... |
| 715 |
def get_best_deals_counting_query(obj, category, brand):
|
716 |
def get_best_deals_counting_query(obj, category, brand):
|
| 716 |
'''
|
717 |
'''
|
| 717 |
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.
|
| 718 |
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.
|
| 719 |
'''
|
720 |
'''
|
| 720 |
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(Item.bestDealValue != None)
|
| 721 |
if category != -1:
|
723 |
if category != -1:
|
| 722 |
all_categories = [category]
|
724 |
all_categories = [category]
|
| 723 |
child_categories = get_child_categories(category)
|
725 |
child_categories = get_child_categories(category)
|
| 724 |
if child_categories is not None:
|
726 |
if child_categories is not None:
|
| 725 |
all_categories = all_categories + child_categories
|
727 |
all_categories = all_categories + child_categories
|
| Line 826... |
Line 828... |
| 826 |
def get_latest_arrivals_counting_query(obj, categories, brand):
|
828 |
def get_latest_arrivals_counting_query(obj, categories, brand):
|
| 827 |
'''
|
829 |
'''
|
| 828 |
Returns the query to be used to count Latest arrivals.
|
830 |
Returns the query to be used to count Latest arrivals.
|
| 829 |
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.
|
| 830 |
'''
|
832 |
'''
|
| - |
|
833 |
query = session.query(obj)
|
| 831 |
query = session.query(obj).filter_by(status=status.ACTIVE)
|
834 |
#query = session.query(obj).filter_by(status=status.ACTIVE)
|
| 832 |
|
835 |
|
| 833 |
all_categories = []
|
836 |
all_categories = []
|
| 834 |
for category in categories:
|
837 |
for category in categories:
|
| 835 |
all_categories.append(category)
|
838 |
all_categories.append(category)
|
| 836 |
child_categories = get_child_categories(category)
|
839 |
child_categories = get_child_categories(category)
|