| Line 114... |
Line 114... |
| 114 |
try:
|
114 |
try:
|
| 115 |
if data['identifier'] is None or len(data['identifier'].strip())==0:
|
115 |
if data['identifier'] is None or len(data['identifier'].strip())==0:
|
| 116 |
return {}
|
116 |
return {}
|
| 117 |
|
117 |
|
| 118 |
if data.get('ignorePricing') ==1:
|
118 |
if data.get('ignorePricing') ==1:
|
| 119 |
return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
|
119 |
return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer'], 'packQuantity':data['quantity']}
|
| 120 |
|
120 |
|
| 121 |
# try:
|
121 |
# try:
|
| 122 |
# if ignoreLastUpdated and data['priceUpdatedOn'] > to_java_date(now - timedelta(minutes=5)):
|
122 |
# if ignoreLastUpdated and data['priceUpdatedOn'] > to_java_date(now - timedelta(minutes=5)):
|
| 123 |
# print "sku id is already updated",data['_id']
|
123 |
# print "sku id is already updated",data['_id']
|
| 124 |
# return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
|
124 |
# return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
|
| Line 156... |
Line 156... |
| 156 |
else:
|
156 |
else:
|
| 157 |
lowestPrice = data['available_price']
|
157 |
lowestPrice = data['available_price']
|
| 158 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':instock,'priceUpdatedOn':to_java_date(now)}}, multi=True)
|
158 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':instock,'priceUpdatedOn':to_java_date(now)}}, multi=True)
|
| 159 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':instock,'codAvailable':data['codAvailable']}}, multi=True)
|
159 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':instock,'codAvailable':data['codAvailable']}}, multi=True)
|
| 160 |
|
160 |
|
| 161 |
return {'_id':data['_id'],'available_price':lowestPrice,'in_stock':instock,'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'],'tagline': data['tagline'], 'offer': data['offer'], 'cheapestBulkPrice': cheapestBulkPrice}
|
161 |
return {'_id':data['_id'],'available_price':lowestPrice,'in_stock':instock,'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'],'tagline': data['tagline'], 'offer': data['offer'], 'cheapestBulkPrice': cheapestBulkPrice, 'packQuantity':data['quantity']}
|
| 162 |
|
162 |
|
| 163 |
except Exception as e:
|
163 |
except Exception as e:
|
| 164 |
print "Exception for _id %d and source %s"%(data['_id'], source_id)
|
164 |
print "Exception for _id %d and source %s"%(data['_id'], source_id)
|
| 165 |
print e
|
165 |
print e
|
| 166 |
return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'],'tagline': data['tagline'], 'offer': data['offer']}
|
166 |
return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'],'tagline': data['tagline'], 'offer': data['offer'],'packQuantity':data['quantity']}
|
| 167 |
|
167 |
|
| 168 |
|
168 |
|
| 169 |
elif source_id ==3:
|
169 |
elif source_id ==3:
|
| 170 |
try:
|
170 |
try:
|
| 171 |
if data['identifier'] is None or len(data['identifier'].strip())==0:
|
171 |
if data['identifier'] is None or len(data['identifier'].strip())==0:
|