| Line 932... |
Line 932... |
| 932 |
try:
|
932 |
try:
|
| 933 |
if multi != 1:
|
933 |
if multi != 1:
|
| 934 |
_id = data.pop('_id')
|
934 |
_id = data.pop('_id')
|
| 935 |
skuBundleId = data.pop('skuBundleId')
|
935 |
skuBundleId = data.pop('skuBundleId')
|
| 936 |
data['updatedOn'] = to_java_date(datetime.now())
|
936 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 937 |
get_mongo_connection().MasterData.Catalog.update({'_id':_id},{"$set":data},upsert=False)
|
937 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 938 |
return {1:'Data updated successfully.'}
|
938 |
return {1:'Data updated successfully.'}
|
| 939 |
else:
|
939 |
else:
|
| 940 |
_id = data.pop('_id')
|
940 |
_id = data.pop('_id')
|
| 941 |
skuBundleId = data.pop('skuBundleId')
|
941 |
skuBundleId = data.pop('skuBundleId')
|
| 942 |
get_mongo_connection().MasterData.Catalog.update({'_id':_id},{"$set":data},upsert=False)
|
942 |
get_mongo_connection().MasterData.Catalog.update({'_id':_id},{"$set":data},upsert=False)
|
| 943 |
similarItems = get_mongo_connection().MasterData.find({'skuBundleId':skuBundleId})
|
943 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
| 944 |
for item in similarItems:
|
944 |
for item in similarItems:
|
| 945 |
if item['_id'] == data['_id']:
|
945 |
if item['_id'] == data['_id']:
|
| 946 |
continue
|
946 |
continue
|
| 947 |
item['updatedOn'] = to_java_date(datetime.now())
|
947 |
item['updatedOn'] = to_java_date(datetime.now())
|
| 948 |
item['thumbnail'] = data['thumbnail']
|
948 |
item['thumbnail'] = data['thumbnail']
|
| 949 |
item['category'] = data['category']
|
949 |
item['category'] = data['category']
|
| 950 |
item['category_id'] = data['category_id']
|
950 |
item['category_id'] = data['category_id']
|
| 951 |
item['tagline'] = data['tagline']
|
951 |
item['tagline'] = data['tagline']
|
| 952 |
item['is_shortage'] = data['is_shortage']
|
952 |
item['is_shortage'] = data['is_shortage']
|
| 953 |
item['mrp'] = data['mrp']
|
953 |
item['mrp'] = data['mrp']
|
| 954 |
get_mongo_connection().MasterData.Catalog.update({'_id':item['_id']},{"$set":item},upsert=False)
|
954 |
get_mongo_connection().Catalog.MasterData.update({'_id':item['_id']},{"$set":item},upsert=False)
|
| 955 |
return {1:'Data updated successfully.'}
|
955 |
return {1:'Data updated successfully.'}
|
| 956 |
except Exception as e:
|
956 |
except Exception as e:
|
| 957 |
print e
|
957 |
print e
|
| 958 |
return {1:'Unable to update data'}
|
958 |
return {1:'Unable to update data'}
|
| 959 |
|
959 |
|