| Line 745... |
Line 745... |
| 745 |
class_name = data.pop('class')
|
745 |
class_name = data.pop('class')
|
| 746 |
if class_name == "SkuSchemeDetails":
|
746 |
if class_name == "SkuSchemeDetails":
|
| 747 |
data['addedOn'] = to_java_date(datetime.now())
|
747 |
data['addedOn'] = to_java_date(datetime.now())
|
| 748 |
_id = data.pop('oid')
|
748 |
_id = data.pop('oid')
|
| 749 |
result = collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
|
749 |
result = collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
|
| 750 |
if class_name != "Notification":
|
750 |
if class_name != "Notifications":
|
| 751 |
record = list(collection.find({'_id':ObjectId(_id)}))
|
751 |
record = list(collection.find({'_id':ObjectId(_id)}))
|
| 752 |
if class_name !="CategoryDiscount":
|
752 |
if class_name !="CategoryDiscount":
|
| 753 |
get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
|
753 |
get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
|
| 754 |
else:
|
754 |
else:
|
| 755 |
get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
|
755 |
get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
|
| Line 1039... |
Line 1039... |
| 1039 |
def getLiveCricScore():
|
1039 |
def getLiveCricScore():
|
| 1040 |
return mc.get('liveScore')
|
1040 |
return mc.get('liveScore')
|
| 1041 |
|
1041 |
|
| 1042 |
def addBundleToNotification(data):
|
1042 |
def addBundleToNotification(data):
|
| 1043 |
try:
|
1043 |
try:
|
| 1044 |
collection = get_mongo_connection().Catalog.Notification
|
1044 |
collection = get_mongo_connection().Catalog.Notifications
|
| 1045 |
cursor = collection.find({'skuBundleId':data['skuBundleId']})
|
1045 |
cursor = collection.find({'skuBundleId':data['skuBundleId']})
|
| 1046 |
if cursor.count() > 0:
|
1046 |
if cursor.count() > 0:
|
| 1047 |
return {0:"SkuBundleId information already present."}
|
1047 |
return {0:"SkuBundleId information already present."}
|
| 1048 |
else:
|
1048 |
else:
|
| 1049 |
collection.insert(data)
|
1049 |
collection.insert(data)
|
| Line 1051... |
Line 1051... |
| 1051 |
except:
|
1051 |
except:
|
| 1052 |
return {0:'Unable to add data.'}
|
1052 |
return {0:'Unable to add data.'}
|
| 1053 |
|
1053 |
|
| 1054 |
def getAllNotifications(offset, limit):
|
1054 |
def getAllNotifications(offset, limit):
|
| 1055 |
data = []
|
1055 |
data = []
|
| 1056 |
collection = get_mongo_connection().Catalog.Notification
|
1056 |
collection = get_mongo_connection().Catalog.Notifications
|
| 1057 |
cursor = collection.find().skip(offset).limit(limit)
|
1057 |
cursor = collection.find().skip(offset).limit(limit)
|
| 1058 |
for val in cursor:
|
1058 |
for val in cursor:
|
| 1059 |
master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
|
1059 |
master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
|
| 1060 |
if len(master) > 0:
|
1060 |
if len(master) > 0:
|
| 1061 |
val['brand'] = master[0]['brand']
|
1061 |
val['brand'] = master[0]['brand']
|