| Line 677... |
Line 677... |
| 677 |
return get_thrift_item_list(items)
|
677 |
return get_thrift_item_list(items)
|
| 678 |
|
678 |
|
| 679 |
def get_latest_arrivals_count(limit, category=-1):
|
679 |
def get_latest_arrivals_count(limit, category=-1):
|
| 680 |
'''
|
680 |
'''
|
| 681 |
Returns the number of latest arrivals which will be displayed on the website.
|
681 |
Returns the number of latest arrivals which will be displayed on the website.
|
| 682 |
Ignores the category if it's passed as -1.
|
682 |
To ignore the categories, pass the list as empty. To ignore brand, pass it as null.
|
| 683 |
'''
|
683 |
'''
|
| 684 |
categories = []
|
684 |
categories = []
|
| 685 |
if category != -1:
|
685 |
if category != -1:
|
| 686 |
categories = [category]
|
686 |
categories = [category]
|
| 687 |
count = get_latest_arrivals_counting_query(func.count(distinct(Item.catalog_item_id)), categories, None).scalar()
|
687 |
count = get_latest_arrivals_counting_query(func.count(distinct(Item.catalog_item_id)), categories, None).scalar()
|
| Line 691... |
Line 691... |
| 691 |
return count
|
691 |
return count
|
| 692 |
|
692 |
|
| 693 |
def get_latest_arrivals_catalog_ids(start_index, stop_index, brand, categories=[]):
|
693 |
def get_latest_arrivals_catalog_ids(start_index, stop_index, brand, categories=[]):
|
| 694 |
'''
|
694 |
'''
|
| 695 |
Returns the catalog_item_ids of the latest arrivals between the start and the stop index
|
695 |
Returns the catalog_item_ids of the latest arrivals between the start and the stop index
|
| 696 |
Ignores the category if it's passed as -1 and the brand if it's passed as None.
|
696 |
To ignore the categories, pass the list as empty. To ignore brand, pass it as null.
|
| 697 |
'''
|
697 |
'''
|
| 698 |
query = get_latest_arrivals_query(Item, categories, brand)
|
698 |
query = get_latest_arrivals_query(Item, categories, brand)
|
| 699 |
latest_arrivals = query.all()[start_index:stop_index]
|
699 |
latest_arrivals = query.all()[start_index:stop_index]
|
| 700 |
return [item.catalog_item_id for item in latest_arrivals]
|
700 |
return [item.catalog_item_id for item in latest_arrivals]
|
| 701 |
|
701 |
|
| 702 |
def get_latest_arrivals_counting_query(obj, categories, brand):
|
702 |
def get_latest_arrivals_counting_query(obj, categories, brand):
|
| 703 |
'''
|
703 |
'''
|
| 704 |
Returns the query to be used to count Latest arrivals.
|
704 |
Returns the query to be used to count Latest arrivals.
|
| 705 |
Ignores the category if it's passed as -1 and the brand if it's passed as None.
|
705 |
To ignore the categories, pass the list as empty. To ignore brand, pass it as null.
|
| 706 |
'''
|
706 |
'''
|
| 707 |
query = session.query(obj).filter_by(status=status.ACTIVE)
|
707 |
query = session.query(obj).filter_by(status=status.ACTIVE)
|
| 708 |
|
708 |
|
| 709 |
all_categories = []
|
709 |
all_categories = []
|
| 710 |
for category in categories:
|
710 |
for category in categories:
|