| Line 35... |
Line 35... |
| 35 |
|
35 |
|
| 36 |
class __SkuInfo:
|
36 |
class __SkuInfo:
|
| 37 |
|
37 |
|
| 38 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
38 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
| 39 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, dealPoints, brand_id, manualDealThresholdPrice,\
|
39 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, dealPoints, brand_id, manualDealThresholdPrice,\
|
| 40 |
codAvailable,showDp):
|
40 |
codAvailable,showDp,gross_price):
|
| 41 |
self._id = _id
|
41 |
self._id = _id
|
| 42 |
self.skuBundleId = skuBundleId
|
42 |
self.skuBundleId = skuBundleId
|
| 43 |
self.category_id = category_id
|
43 |
self.category_id = category_id
|
| 44 |
self.mrp = mrp
|
44 |
self.mrp = mrp
|
| 45 |
self.available_price = available_price
|
45 |
self.available_price = available_price
|
| Line 61... |
Line 61... |
| 61 |
self.dealPoints = dealPoints
|
61 |
self.dealPoints = dealPoints
|
| 62 |
self.brand_id = brand_id
|
62 |
self.brand_id = brand_id
|
| 63 |
self.manualDealThresholdPrice = manualDealThresholdPrice
|
63 |
self.manualDealThresholdPrice = manualDealThresholdPrice
|
| 64 |
self.codAvailable = codAvailable
|
64 |
self.codAvailable = codAvailable
|
| 65 |
self.showDp = showDp
|
65 |
self.showDp = showDp
|
| - |
|
66 |
self.gross_price = gross_price
|
| 66 |
|
67 |
|
| 67 |
|
68 |
|
| 68 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
69 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
| 69 |
global con
|
70 |
global con
|
| 70 |
if con is None:
|
71 |
if con is None:
|
| Line 90... |
Line 91... |
| 90 |
#topSkus = collection.find( {'_id':664})
|
91 |
#topSkus = collection.find( {'_id':664})
|
| 91 |
for sku in topSkus:
|
92 |
for sku in topSkus:
|
| 92 |
"""Fix this """
|
93 |
"""Fix this """
|
| 93 |
#TODO Compute deal flags else where.
|
94 |
#TODO Compute deal flags else where.
|
| 94 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
95 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
| 95 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0, sku['brand_id'], None, sku['codAvailable'], 0)
|
96 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0, sku['brand_id'], None, sku['codAvailable'], 0, sku['gross_price'])
|
| 96 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
|
97 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
|
| 97 |
if len(exceptionalNlc) > 0:
|
98 |
if len(exceptionalNlc) > 0:
|
| 98 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
99 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
| 99 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
100 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
| 100 |
info.minNlc = exceptionalNlc[0]['minNlc']
|
101 |
info.minNlc = exceptionalNlc[0]['minNlc']
|