| Line 30... |
Line 30... |
| 30 |
|
30 |
|
| 31 |
mc = MemCache(options.mongoHost)
|
31 |
mc = MemCache(options.mongoHost)
|
| 32 |
|
32 |
|
| 33 |
DataService.initialize(db_hostname=options.hostname)
|
33 |
DataService.initialize(db_hostname=options.hostname)
|
| 34 |
|
34 |
|
| 35 |
SOURCE_MAP = {'AMAZON':1,'FLIPKART':2,'SNAPDEAL':3,'SAHOLIC':4, 'SHOPCLUES.COM':5}
|
35 |
SOURCE_MAP = {'AMAZON':1,'FLIPKART':2,'SNAPDEAL':3,'SAHOLIC':4, 'SHOPCLUES.COM':5,'PAYTM.COM':6}
|
| 36 |
|
36 |
|
| 37 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
37 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
| 38 |
global con
|
38 |
global con
|
| 39 |
if con is None:
|
39 |
if con is None:
|
| 40 |
print "Establishing connection %s host and port %d" %(host,port)
|
40 |
print "Establishing connection %s host and port %d" %(host,port)
|
| Line 215... |
Line 215... |
| 215 |
if mc.get("negative_deals") is None:
|
215 |
if mc.get("negative_deals") is None:
|
| 216 |
populateNegativeDeals()
|
216 |
populateNegativeDeals()
|
| 217 |
if similarItem['in_stock'] == 0 or similarItem['_id'] in mc.get("negative_deals"):
|
217 |
if similarItem['in_stock'] == 0 or similarItem['_id'] in mc.get("negative_deals"):
|
| 218 |
get_mongo_connection().Catalog.Deals.update({ '_id' : similarItem['_id'] }, {'$set':{'showDeal':0, 'prepaidDeal':0 }})
|
218 |
get_mongo_connection().Catalog.Deals.update({ '_id' : similarItem['_id'] }, {'$set':{'showDeal':0, 'prepaidDeal':0 }})
|
| 219 |
continue
|
219 |
continue
|
| - |
|
220 |
if similarItem['source_id'] == SOURCE_MAP.get('PAYTM.COM'):
|
| - |
|
221 |
similarItem['available_price'] = similarItem['gross_price']
|
| 220 |
if similarItem['source_id'] == SOURCE_MAP.get('SHOPCLUES.COM') and similarItem['rank']==0:
|
222 |
if similarItem['source_id'] == SOURCE_MAP.get('SHOPCLUES.COM') and similarItem['rank']==0:
|
| 221 |
get_mongo_connection().Catalog.Deals.update({ '_id' : similarItem['_id'] }, {'$set':{'showDeal':0,'prepaidDeal':0 }})
|
223 |
get_mongo_connection().Catalog.Deals.update({ '_id' : similarItem['_id'] }, {'$set':{'showDeal':0,'prepaidDeal':0 }})
|
| 222 |
continue
|
224 |
continue
|
| 223 |
if similarItem['available_price'] < prepaidBestPrice:
|
225 |
if similarItem['available_price'] < prepaidBestPrice:
|
| 224 |
prepaidBestOne = similarItem
|
226 |
prepaidBestOne = similarItem
|