| Line 106... |
Line 106... |
| 106 |
item['availability'] = availability
|
106 |
item['availability'] = availability
|
| 107 |
if availability < maxQuantity:
|
107 |
if availability < maxQuantity:
|
| 108 |
temp_maxQuantity = availability
|
108 |
temp_maxQuantity = availability
|
| 109 |
else:
|
109 |
else:
|
| 110 |
temp_maxQuantity = maxQuantity
|
110 |
temp_maxQuantity = maxQuantity
|
| 111 |
if item.get('maxQuantity') is None or item.get('maxQuantity')==0:
|
111 |
if item.get('maxQuantity') is None or item.get('maxQuantity')==0:
|
| 112 |
item['maxQuantity'] = temp_maxQuantity
|
112 |
item['maxQuantity'] = temp_maxQuantity
|
| 113 |
else:
|
113 |
else:
|
| 114 |
item['maxQuantity'] = min(availability,item.get('maxQuantity'))
|
114 |
item['maxQuantity'] = min(availability,item.get('maxQuantity'))
|
| 115 |
if item['minBuyQuantity'] > availability:
|
115 |
if item['minBuyQuantity'] > availability:
|
| 116 |
item['minBuyQuantity'] = availability
|
116 |
item['minBuyQuantity'] = availability
|
| - |
|
117 |
for bulkPricing in item['bulkPricing']:
|
| - |
|
118 |
if bulkPricing['quantity'] < item['minBuyQuantity'] or bulkPricing['quantity'] > item['maxQuantity']:
|
| - |
|
119 |
item['bulkPricing'].remove(bulkPricing)
|
| - |
|
120 |
item['bulkPricing'] = sorted(item['bulkPricing'], key=lambda k: k['quantity'],reverse=True)
|
| 117 |
temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
|
121 |
temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
|
| 118 |
mc = get_memcache_connection(host=options.mongoHost)
|
122 |
mc = get_memcache_connection(host=options.mongoHost)
|
| 119 |
mc.set(str("item_availability_"+str(k)), temp, 60*60)
|
123 |
mc.set(str("item_availability_"+str(k)), temp, 60*60)
|
| 120 |
|
124 |
|
| 121 |
def flagNoAvailableItems():
|
125 |
def flagNoAvailableItems():
|