| Line 1034... |
Line 1034... |
| 1034 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1034 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1035 |
return {1:'Data added successfully'}
|
1035 |
return {1:'Data added successfully'}
|
| 1036 |
except Exception as e:
|
1036 |
except Exception as e:
|
| 1037 |
print e
|
1037 |
print e
|
| 1038 |
return {0:'Unable to add data.'}
|
1038 |
return {0:'Unable to add data.'}
|
| - |
|
1039 |
finally:
|
| - |
|
1040 |
session.close()
|
| 1039 |
|
1041 |
|
| 1040 |
def addItemToExistingBundle(data):
|
1042 |
def addItemToExistingBundle(data):
|
| 1041 |
try:
|
1043 |
try:
|
| 1042 |
data['updatedOn'] = to_java_date(datetime.now())
|
1044 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 1043 |
data['addedOn'] = to_java_date(datetime.now())
|
1045 |
data['addedOn'] = to_java_date(datetime.now())
|
| Line 1050... |
Line 1052... |
| 1050 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1052 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1051 |
return {1:'Data added successfully.'}
|
1053 |
return {1:'Data added successfully.'}
|
| 1052 |
except Exception as e:
|
1054 |
except Exception as e:
|
| 1053 |
print e
|
1055 |
print e
|
| 1054 |
return {0:'Unable to add data.'}
|
1056 |
return {0:'Unable to add data.'}
|
| - |
|
1057 |
finally:
|
| - |
|
1058 |
session.close()
|
| 1055 |
|
1059 |
|
| 1056 |
def updateMaster(data, multi):
|
1060 |
def updateMaster(data, multi):
|
| - |
|
1061 |
try:
|
| 1057 |
print data
|
1062 |
print data
|
| 1058 |
if multi != 1:
|
1063 |
if multi != 1:
|
| 1059 |
_id = data.pop('_id')
|
1064 |
_id = data.pop('_id')
|
| 1060 |
skuBundleId = data.pop('skuBundleId')
|
1065 |
skuBundleId = data.pop('skuBundleId')
|
| 1061 |
data['updatedOn'] = to_java_date(datetime.now())
|
1066 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 1062 |
data['identifier'] = str(data['identifier'])
|
1067 |
data['identifier'] = str(data['identifier'])
|
| 1063 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1068 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1064 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1069 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1065 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1070 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1066 |
return {1:'Data updated successfully.'}
|
1071 |
return {1:'Data updated successfully.'}
|
| 1067 |
else:
|
1072 |
else:
|
| 1068 |
_id = data.pop('_id')
|
1073 |
_id = data.pop('_id')
|
| 1069 |
skuBundleId = data.pop('skuBundleId')
|
1074 |
skuBundleId = data.pop('skuBundleId')
|
| 1070 |
data['updatedOn'] = to_java_date(datetime.now())
|
1075 |
data['updatedOn'] = to_java_date(datetime.now())
|
| 1071 |
data['identifier'] = str(data['identifier'])
|
1076 |
data['identifier'] = str(data['identifier'])
|
| 1072 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1077 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1073 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1078 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1074 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1079 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1075 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
1080 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
| 1076 |
for item in similarItems:
|
1081 |
for item in similarItems:
|
| 1077 |
if item['_id'] == _id:
|
1082 |
if item['_id'] == _id:
|
| 1078 |
continue
|
1083 |
continue
|
| 1079 |
item['updatedOn'] = to_java_date(datetime.now())
|
1084 |
item['updatedOn'] = to_java_date(datetime.now())
|
| 1080 |
item['thumbnail'] = data['thumbnail']
|
1085 |
item['thumbnail'] = data['thumbnail']
|
| 1081 |
item['category'] = data['category']
|
1086 |
item['category'] = data['category']
|
| 1082 |
item['category_id'] = data['category_id']
|
1087 |
item['category_id'] = data['category_id']
|
| 1083 |
item['tagline'] = data['tagline']
|
1088 |
item['tagline'] = data['tagline']
|
| 1084 |
item['is_shortage'] = data['is_shortage']
|
1089 |
item['is_shortage'] = data['is_shortage']
|
| 1085 |
item['mrp'] = data['mrp']
|
1090 |
item['mrp'] = data['mrp']
|
| 1086 |
item['status'] = data['status']
|
1091 |
item['status'] = data['status']
|
| 1087 |
item['maxPrice'] = data['maxPrice']
|
1092 |
item['maxPrice'] = data['maxPrice']
|
| 1088 |
item['brand_id'] = data['brand_id']
|
1093 |
item['brand_id'] = data['brand_id']
|
| 1089 |
similar_item_id = item.pop('_id')
|
1094 |
similar_item_id = item.pop('_id')
|
| 1090 |
get_mongo_connection().Catalog.MasterData.update({'_id':similar_item_id},{"$set":item},upsert=False)
|
1095 |
get_mongo_connection().Catalog.MasterData.update({'_id':similar_item_id},{"$set":item},upsert=False)
|
| 1091 |
return {1:'Data updated successfully.'}
|
1096 |
return {1:'Data updated successfully.'}
|
| - |
|
1097 |
finally:
|
| - |
|
1098 |
session.close()
|
| 1092 |
|
1099 |
|
| 1093 |
def getLiveCricScore():
|
1100 |
def getLiveCricScore():
|
| 1094 |
return mc.get('liveScore')
|
1101 |
return mc.get('liveScore')
|
| 1095 |
|
1102 |
|
| 1096 |
def addBundleToNotification(data):
|
1103 |
def addBundleToNotification(data):
|