| Line 171... |
Line 171... |
| 171 |
global LATEST_UPDATED_ITEMS
|
171 |
global LATEST_UPDATED_ITEMS
|
| 172 |
populated = 0
|
172 |
populated = 0
|
| 173 |
while(populated <= len(LATEST_UPDATED_ITEMS)):
|
173 |
while(populated <= len(LATEST_UPDATED_ITEMS)):
|
| 174 |
inventory_client = InventoryClient().get_client()
|
174 |
inventory_client = InventoryClient().get_client()
|
| 175 |
for obj in LATEST_UPDATED_ITEMS[populated:300+populated]:
|
175 |
for obj in LATEST_UPDATED_ITEMS[populated:300+populated]:
|
| 176 |
if obj.maxNlc > 0 and obj.minNlc > 0:
|
176 |
if (obj.maxNlc > 0 and obj.minNlc > 0) or obj.category_id==6:
|
| 177 |
continue
|
177 |
continue
|
| 178 |
saholic_sku = list(get_mongo_connection().Catalog.MasterData.find( {"$and":[{'skuBundleId': obj.skuBundleId}, { 'source_id' : SOURCE_MAP.get('SAHOLIC')}] }))
|
178 |
saholic_sku = list(get_mongo_connection().Catalog.MasterData.find( {"$and":[{'skuBundleId': obj.skuBundleId}, { 'source_id' : SOURCE_MAP.get('SAHOLIC')}] }))
|
| 179 |
identifier = None
|
179 |
identifier = None
|
| 180 |
if len(saholic_sku) > 0:
|
180 |
if len(saholic_sku) > 0:
|
| 181 |
identifier = saholic_sku[0]['identifier']
|
181 |
identifier = saholic_sku[0]['identifier']
|
| Line 306... |
Line 306... |
| 306 |
sku['bestSellerPoints'] = -120
|
306 |
sku['bestSellerPoints'] = -120
|
| 307 |
#sku['totalPoints'] = sku['bestSellerPoints'] + sku['nlcPoints']
|
307 |
#sku['totalPoints'] = sku['bestSellerPoints'] + sku['nlcPoints']
|
| 308 |
get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'bestSellerPoints':sku['bestSellerPoints']}},multi=False)
|
308 |
get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'bestSellerPoints':sku['bestSellerPoints']}},multi=False)
|
| 309 |
|
309 |
|
| 310 |
shortageSkus = get_mongo_connection().Catalog.MasterData.find({"$and":[{'is_shortage': 1 }, { 'source_id' : { "$in": SOURCE_MAP.values() } }] }).distinct('_id')
|
310 |
shortageSkus = get_mongo_connection().Catalog.MasterData.find({"$and":[{'is_shortage': 1 }, { 'source_id' : { "$in": SOURCE_MAP.values() } }] }).distinct('_id')
|
| 311 |
print "Shortage skus"
|
- |
|
| 312 |
print shortageSkus
|
- |
|
| 313 |
|
311 |
|
| 314 |
for sku in allItems:
|
312 |
for sku in allItems:
|
| 315 |
deal_item = list(get_mongo_connection().Catalog.Deals.find({'skuBundleId':sku['skuBundleId']}).sort('bestSellerPoints',pymongo.DESCENDING).limit(1))
|
313 |
deal_item = list(get_mongo_connection().Catalog.Deals.find({'skuBundleId':sku['skuBundleId']}).sort('bestSellerPoints',pymongo.DESCENDING).limit(1))
|
| 316 |
sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints']
|
314 |
sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints']
|
| 317 |
shortagePoints = 50 if sku['_id'] in shortageSkus else 0
|
315 |
shortagePoints = 50 if sku['_id'] in shortageSkus else 0
|
| 318 |
print "Shortage points for ",sku['_id']
|
- |
|
| 319 |
print shortagePoints
|
- |
|
| 320 |
|
316 |
|
| 321 |
dealPoints = DEAL_POINTS_MAP.get(sku['skuBundleId'])
|
317 |
dealPoints = DEAL_POINTS_MAP.get(sku['skuBundleId'])
|
| 322 |
|
318 |
|
| 323 |
if dealPoints is not None and dealPoints.manualDealThresholdPrice >= sku['available_price']:
|
319 |
if dealPoints is not None and dealPoints.manualDealThresholdPrice >= sku['available_price']:
|
| 324 |
sku['dealPoints'] = dealPoints.points
|
320 |
sku['dealPoints'] = dealPoints.points
|