| Line 45... |
Line 45... |
| 45 |
|
45 |
|
| 46 |
class __SkuInfo:
|
46 |
class __SkuInfo:
|
| 47 |
|
47 |
|
| 48 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
48 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
| 49 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, brand_id, manualDealThresholdPrice,\
|
49 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, brand_id, manualDealThresholdPrice,\
|
| 50 |
codAvailable,showDp,gross_price):
|
50 |
codAvailable,showDp,gross_price, subCategoryId):
|
| 51 |
self._id = _id
|
51 |
self._id = _id
|
| 52 |
self.skuBundleId = skuBundleId
|
52 |
self.skuBundleId = skuBundleId
|
| 53 |
self.category_id = category_id
|
53 |
self.category_id = category_id
|
| 54 |
self.mrp = mrp
|
54 |
self.mrp = mrp
|
| 55 |
self.available_price = available_price
|
55 |
self.available_price = available_price
|
| Line 71... |
Line 71... |
| 71 |
self.brand_id = brand_id
|
71 |
self.brand_id = brand_id
|
| 72 |
self.manualDealThresholdPrice = manualDealThresholdPrice
|
72 |
self.manualDealThresholdPrice = manualDealThresholdPrice
|
| 73 |
self.codAvailable = codAvailable
|
73 |
self.codAvailable = codAvailable
|
| 74 |
self.showDp = showDp
|
74 |
self.showDp = showDp
|
| 75 |
self.gross_price = gross_price
|
75 |
self.gross_price = gross_price
|
| - |
|
76 |
self.subCategoryId = subCategoryId
|
| 76 |
|
77 |
|
| 77 |
|
78 |
|
| 78 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
79 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
| 79 |
global con
|
80 |
global con
|
| 80 |
if con is None:
|
81 |
if con is None:
|
| Line 100... |
Line 101... |
| 100 |
#topSkus = collection.find( {'_id':664})
|
101 |
#topSkus = collection.find( {'_id':664})
|
| 101 |
for sku in topSkus:
|
102 |
for sku in topSkus:
|
| 102 |
"""Fix this """
|
103 |
"""Fix this """
|
| 103 |
#TODO Compute deal flags else where.
|
104 |
#TODO Compute deal flags else where.
|
| 104 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
105 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
| 105 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, sku['brand_id'], None, sku['codAvailable'], 0, sku['gross_price'])
|
106 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, sku['brand_id'], None, sku['codAvailable'], 0, sku['gross_price'], sku['subCategoryId'])
|
| 106 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
|
107 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
|
| 107 |
if len(exceptionalNlc) > 0:
|
108 |
if len(exceptionalNlc) > 0:
|
| 108 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
109 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
| 109 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
110 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
| 110 |
info.minNlc = exceptionalNlc[0]['minNlc']
|
111 |
info.minNlc = exceptionalNlc[0]['minNlc']
|