| Line 739... |
Line 739... |
| 739 |
class_name = data.pop('class')
|
739 |
class_name = data.pop('class')
|
| 740 |
if class_name == "SkuSchemeDetails":
|
740 |
if class_name == "SkuSchemeDetails":
|
| 741 |
data['addedOn'] = to_java_date(datetime.now())
|
741 |
data['addedOn'] = to_java_date(datetime.now())
|
| 742 |
_id = data.pop('oid')
|
742 |
_id = data.pop('oid')
|
| 743 |
result = collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
|
743 |
result = collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
|
| - |
|
744 |
if class_name != "Notification":
|
| 744 |
record = list(collection.find({'_id':ObjectId(_id)}))
|
745 |
record = list(collection.find({'_id':ObjectId(_id)}))
|
| 745 |
if class_name !="CategoryDiscount":
|
746 |
if class_name !="CategoryDiscount":
|
| 746 |
get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
|
747 |
get_mongo_connection().Catalog.MasterData.update({'_id':record[0]['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}})
|
| 747 |
else:
|
748 |
else:
|
| 748 |
get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
|
749 |
get_mongo_connection().Catalog.MasterData.update({'brand':re.compile(record[0]['brand'], re.IGNORECASE),'category_id':record[0]['category_id']}, \
|
| 749 |
{"$set":{'updatedOn':to_java_date(datetime.now())}},upsert=False,multi=True)
|
750 |
{"$set":{'updatedOn':to_java_date(datetime.now())}},upsert=False,multi=True)
|
| 750 |
return {1:"Data updated successfully"}
|
751 |
return {1:"Data updated successfully"}
|
| 751 |
except Exception as e:
|
752 |
except Exception as e:
|
| 752 |
print e
|
753 |
print e
|
| 753 |
return {0:"Data not updated."}
|
754 |
return {0:"Data not updated."}
|
| 754 |
else:
|
755 |
else:
|
| Line 1022... |
Line 1023... |
| 1022 |
item['category_id'] = data['category_id']
|
1023 |
item['category_id'] = data['category_id']
|
| 1023 |
item['tagline'] = data['tagline']
|
1024 |
item['tagline'] = data['tagline']
|
| 1024 |
item['is_shortage'] = data['is_shortage']
|
1025 |
item['is_shortage'] = data['is_shortage']
|
| 1025 |
item['mrp'] = data['mrp']
|
1026 |
item['mrp'] = data['mrp']
|
| 1026 |
item['status'] = data['status']
|
1027 |
item['status'] = data['status']
|
| - |
|
1028 |
item['maxPrice'] = data['maxPrice']
|
| 1027 |
similar_item_id = item.pop('_id')
|
1029 |
similar_item_id = item.pop('_id')
|
| 1028 |
get_mongo_connection().Catalog.MasterData.update({'_id':similar_item_id},{"$set":item},upsert=False)
|
1030 |
get_mongo_connection().Catalog.MasterData.update({'_id':similar_item_id},{"$set":item},upsert=False)
|
| 1029 |
return {1:'Data updated successfully.'}
|
1031 |
return {1:'Data updated successfully.'}
|
| 1030 |
|
1032 |
|
| 1031 |
def getLiveCricScore():
|
1033 |
def getLiveCricScore():
|
| 1032 |
return mc.get('liveScore')
|
1034 |
return mc.get('liveScore')
|
| - |
|
1035 |
|
| - |
|
1036 |
def addBundleToNotification(data):
|
| - |
|
1037 |
try:
|
| - |
|
1038 |
collection = get_mongo_connection().Catalog.Notification
|
| - |
|
1039 |
cursor = collection.find({'skuBundleId':data['skuBundleId']})
|
| - |
|
1040 |
if cursor.count() > 0:
|
| - |
|
1041 |
return {0:"SkuBundleId information already present."}
|
| - |
|
1042 |
else:
|
| - |
|
1043 |
collection.insert(data)
|
| - |
|
1044 |
return {1:'Data updated successfully.'}
|
| - |
|
1045 |
except:
|
| - |
|
1046 |
return {0:'Unable to add data.'}
|
| - |
|
1047 |
|
| - |
|
1048 |
def getAllNotifications(offset, limit):
|
| - |
|
1049 |
data = []
|
| - |
|
1050 |
collection = get_mongo_connection().Catalog.Notification
|
| - |
|
1051 |
cursor = collection.find().skip(offset).limit(limit)
|
| - |
|
1052 |
for val in cursor:
|
| - |
|
1053 |
master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
|
| - |
|
1054 |
if len(master) > 0:
|
| - |
|
1055 |
val['brand'] = master[0]['brand']
|
| - |
|
1056 |
val['source_product_name'] = master[0]['source_product_name']
|
| - |
|
1057 |
val['skuBundleId'] = master[0]['skuBundleId']
|
| - |
|
1058 |
else:
|
| - |
|
1059 |
val['brand'] = ""
|
| - |
|
1060 |
val['source_product_name'] = ""
|
| - |
|
1061 |
val['skuBundleId'] = ""
|
| - |
|
1062 |
data.append(val)
|
| - |
|
1063 |
return data
|
| 1033 |
|
1064 |
|
| 1034 |
def main():
|
1065 |
def main():
|
| 1035 |
print __getBundledSkusfromSku(1)
|
1066 |
print __getBundledSkusfromSku(1)
|
| 1036 |
|
1067 |
|
| 1037 |
|
1068 |
|