| Line 112... |
Line 112... |
| 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 |
if k==1007389:
|
| - |
|
118 |
print item['bulkPricing']
|
| - |
|
119 |
toremove = []
|
| 117 |
for bulkPricing in item['bulkPricing']:
|
120 |
for bulkPricing in item['bulkPricing']:
|
| - |
|
121 |
if k==1007389:
|
| - |
|
122 |
print bulkPricing
|
| 118 |
if bulkPricing['quantity'] < item['minBuyQuantity'] or bulkPricing['quantity'] > item['maxQuantity']:
|
123 |
if bulkPricing['quantity'] < item['minBuyQuantity'] or bulkPricing['quantity'] > item['maxQuantity']:
|
| - |
|
124 |
if k==1007389:
|
| - |
|
125 |
print "Removing ",bulkPricing
|
| - |
|
126 |
toremove.append(bulkPricing)
|
| - |
|
127 |
for removePricing in toremove:
|
| 119 |
item['bulkPricing'].remove(bulkPricing)
|
128 |
item['bulkPricing'].remove(removePricing)
|
| - |
|
129 |
if k==1007389:
|
| - |
|
130 |
print "Final bulk pricing ",item['bulkPricing']
|
| 120 |
item['bulkPricing'] = sorted(item['bulkPricing'], key=lambda k: k['quantity'],reverse=True)
|
131 |
item['bulkPricing'] = sorted(item['bulkPricing'], key=lambda k: k['quantity'],reverse=False)
|
| 121 |
temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
|
132 |
temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
|
| 122 |
mc = get_memcache_connection(host=options.mongoHost)
|
133 |
mc = get_memcache_connection(host=options.mongoHost)
|
| 123 |
mc.set(str("item_availability_"+str(k)), temp, 60*60)
|
134 |
mc.set(str("item_availability_"+str(k)), temp, 60*60)
|
| 124 |
|
135 |
|
| 125 |
def flagNoAvailableItems():
|
136 |
def flagNoAvailableItems():
|
| Line 174... |
Line 185... |
| 174 |
print "Flagged items ",flaggedItems
|
185 |
print "Flagged items ",flaggedItems
|
| 175 |
get_inventory_client().updateItemAvailabilityForItemIds(flaggedItems)
|
186 |
get_inventory_client().updateItemAvailabilityForItemIds(flaggedItems)
|
| 176 |
fetchItemAvailablity()
|
187 |
fetchItemAvailablity()
|
| 177 |
addInfoToMemCache()
|
188 |
addInfoToMemCache()
|
| 178 |
mc = get_memcache_connection(host=options.mongoHost)
|
189 |
mc = get_memcache_connection(host=options.mongoHost)
|
| 179 |
print mc.get("item_availability_1005556")
|
190 |
print mc.get("item_availability_1007389")
|