| Line 65... |
Line 65... |
| 65 |
topSkus = list(get_mongo_connection().Catalog.MasterData.find( {"$and":[{'updatedOn': { "$gt": to_java_date(now - timedelta(hours=4))} }, { 'source_id' : { "$in": SOURCE_MAP.values() } }] }).skip(offset).limit(300))
|
65 |
topSkus = list(get_mongo_connection().Catalog.MasterData.find( {"$and":[{'updatedOn': { "$gt": to_java_date(now - timedelta(hours=4))} }, { 'source_id' : { "$in": SOURCE_MAP.values() } }] }).skip(offset).limit(300))
|
| 66 |
if len((topSkus)) == 0:
|
66 |
if len((topSkus)) == 0:
|
| 67 |
break
|
67 |
break
|
| 68 |
#topSkus = collection.find( {'_id':664})
|
68 |
#topSkus = collection.find( {'_id':664})
|
| 69 |
for sku in topSkus:
|
69 |
for sku in topSkus:
|
| - |
|
70 |
"""Fix this """
|
| - |
|
71 |
#TODO Compute deal flags else where.
|
| 70 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
72 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
| 71 |
None, None, None, None, None, None, sku['status'], sku['in_stock'],None,0)
|
73 |
None, None, None, None, None, None, sku['status'], sku['in_stock'],None,0)
|
| 72 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'sku':info._id}, {'overrideNlc':1} ]} ))
|
74 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'sku':info._id}, {'overrideNlc':1} ]} ))
|
| 73 |
if len(exceptionalNlc) > 0:
|
75 |
if len(exceptionalNlc) > 0:
|
| 74 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
76 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
| Line 247... |
Line 249... |
| 247 |
for similarItem in similarItems:
|
249 |
for similarItem in similarItems:
|
| 248 |
toUpdate.append(similarItem['_id'])
|
250 |
toUpdate.append(similarItem['_id'])
|
| 249 |
toUpdate.remove(bestOne['_id'])
|
251 |
toUpdate.remove(bestOne['_id'])
|
| 250 |
get_mongo_connection().Catalog.Deals.update({ '_id' : bestOne['_id'] }, {'$set':{'showDeal':1 }})
|
252 |
get_mongo_connection().Catalog.Deals.update({ '_id' : bestOne['_id'] }, {'$set':{'showDeal':1 }})
|
| 251 |
if len(toUpdate) > 0:
|
253 |
if len(toUpdate) > 0:
|
| 252 |
get_mongo_connection().Catalog.Deals.update({ '_id' : { "$in": toUpdate } }, {'$set':{'showDeal':0 }})
|
254 |
get_mongo_connection().Catalog.Deals.update({ '_id' : { "$in": toUpdate } }, {'$set':{'showDeal':0 }},upsert=False, multi=True)
|
| 253 |
|
255 |
|
| 254 |
def main():
|
256 |
def main():
|
| 255 |
populateStuff()
|
257 |
populateStuff()
|
| 256 |
calculateNlc()
|
258 |
calculateNlc()
|
| 257 |
calculateNlcPoints()
|
259 |
calculateNlcPoints()
|