| Line 502... |
Line 502... |
| 502 |
item[0]['dp'] = 0.0
|
502 |
item[0]['dp'] = 0.0
|
| 503 |
item[0]['showDp'] = 0
|
503 |
item[0]['showDp'] = 0
|
| 504 |
try:
|
504 |
try:
|
| 505 |
item[0]['thumbnail'] = item[0]['thumbnail'].strip()
|
505 |
item[0]['thumbnail'] = item[0]['thumbnail'].strip()
|
| 506 |
except:
|
506 |
except:
|
| 507 |
pass
|
507 |
pass
|
| 508 |
temp.append(item[0])
|
508 |
temp.append(item[0])
|
| 509 |
if len(temp) > 1:
|
509 |
if len(temp) > 1:
|
| 510 |
temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
|
510 |
temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
|
| 511 |
dealsListMap.append(temp)
|
511 |
dealsListMap.append(temp)
|
| 512 |
return dealsListMap
|
512 |
return dealsListMap
|
| Line 1093... |
Line 1093... |
| 1093 |
max_bundle = list(get_mongo_connection().Catalog.MasterData.find().sort([('skuBundleId',pymongo.DESCENDING)]).limit(1))
|
1093 |
max_bundle = list(get_mongo_connection().Catalog.MasterData.find().sort([('skuBundleId',pymongo.DESCENDING)]).limit(1))
|
| 1094 |
data['_id'] = max_id[0]['_id'] + 1
|
1094 |
data['_id'] = max_id[0]['_id'] + 1
|
| 1095 |
data['skuBundleId'] = max_bundle[0]['skuBundleId'] + 1
|
1095 |
data['skuBundleId'] = max_bundle[0]['skuBundleId'] + 1
|
| 1096 |
data['identifier'] = str(data['identifier'])
|
1096 |
data['identifier'] = str(data['identifier'])
|
| 1097 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1097 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| - |
|
1098 |
data['model_name'] = str(data['model_name'])
|
| 1098 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1099 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1099 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1100 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1100 |
return {1:'Data added successfully'}
|
1101 |
return {1:'Data added successfully'}
|
| 1101 |
except Exception as e:
|
1102 |
except Exception as e:
|
| 1102 |
print e
|
1103 |
print e
|
| Line 1111... |
Line 1112... |
| 1111 |
data['priceUpdatedOn'] = to_java_date(datetime.now())
|
1112 |
data['priceUpdatedOn'] = to_java_date(datetime.now())
|
| 1112 |
max_id = list(get_mongo_connection().Catalog.MasterData.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
|
1113 |
max_id = list(get_mongo_connection().Catalog.MasterData.find().sort([('_id',pymongo.DESCENDING)]).limit(1))
|
| 1113 |
data['_id'] = max_id[0]['_id'] + 1
|
1114 |
data['_id'] = max_id[0]['_id'] + 1
|
| 1114 |
data['identifier'] = str(data['identifier'])
|
1115 |
data['identifier'] = str(data['identifier'])
|
| 1115 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1116 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| - |
|
1117 |
data['model_name'] = str(data['model_name'])
|
| 1116 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1118 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1117 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1119 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1118 |
return {1:'Data added successfully.'}
|
1120 |
return {1:'Data added successfully.'}
|
| 1119 |
except Exception as e:
|
1121 |
except Exception as e:
|
| 1120 |
print e
|
1122 |
print e
|
| Line 1129... |
Line 1131... |
| 1129 |
_id = data.pop('_id')
|
1131 |
_id = data.pop('_id')
|
| 1130 |
skuBundleId = data.pop('skuBundleId')
|
1132 |
skuBundleId = data.pop('skuBundleId')
|
| 1131 |
data['updatedOn'] = to_java_date(datetime.now())
|
1133 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 1132 |
data['identifier'] = str(data['identifier'])
|
1134 |
data['identifier'] = str(data['identifier'])
|
| 1133 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1135 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| - |
|
1136 |
data['model_name'] = str(data['model_name'])
|
| 1134 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1137 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1135 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1138 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1136 |
return {1:'Data updated successfully.'}
|
1139 |
return {1:'Data updated successfully.'}
|
| 1137 |
else:
|
1140 |
else:
|
| 1138 |
_id = data.pop('_id')
|
1141 |
_id = data.pop('_id')
|
| 1139 |
skuBundleId = data.pop('skuBundleId')
|
1142 |
skuBundleId = data.pop('skuBundleId')
|
| 1140 |
data['updatedOn'] = to_java_date(datetime.now())
|
1143 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 1141 |
data['identifier'] = str(data['identifier'])
|
1144 |
data['identifier'] = str(data['identifier'])
|
| 1142 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1145 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1143 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1146 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| - |
|
1147 |
data['model_name'] = str(data['model_name'])
|
| 1144 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1148 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1145 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
1149 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
| 1146 |
for item in similarItems:
|
1150 |
for item in similarItems:
|
| 1147 |
if item['_id'] == _id:
|
1151 |
if item['_id'] == _id:
|
| 1148 |
continue
|
1152 |
continue
|
| Line 1659... |
Line 1663... |
| 1659 |
|
1663 |
|
| 1660 |
|
1664 |
|
| 1661 |
|
1665 |
|
| 1662 |
if __name__=='__main__':
|
1666 |
if __name__=='__main__':
|
| 1663 |
main()
|
1667 |
main()
|
| - |
|
1668 |
|