| Line 33... |
Line 33... |
| 33 |
now = datetime.now()
|
33 |
now = datetime.now()
|
| 34 |
|
34 |
|
| 35 |
class __SkuInfo:
|
35 |
class __SkuInfo:
|
| 36 |
|
36 |
|
| 37 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
37 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
| 38 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, dealPoints):
|
38 |
maxDiscount, discountType, dp, nlcPoints, status, in_stock, maxprice, brand, dealType, dealPoints, brand_id):
|
| 39 |
self._id = _id
|
39 |
self._id = _id
|
| 40 |
self.skuBundleId = skuBundleId
|
40 |
self.skuBundleId = skuBundleId
|
| 41 |
self.category_id = category_id
|
41 |
self.category_id = category_id
|
| 42 |
self.mrp = mrp
|
42 |
self.mrp = mrp
|
| 43 |
self.available_price = available_price
|
43 |
self.available_price = available_price
|
| Line 55... |
Line 55... |
| 55 |
self.in_stock = in_stock
|
55 |
self.in_stock = in_stock
|
| 56 |
self.maxprice = maxprice
|
56 |
self.maxprice = maxprice
|
| 57 |
self.brand = brand
|
57 |
self.brand = brand
|
| 58 |
self.dealType = dealType
|
58 |
self.dealType = dealType
|
| 59 |
self.dealPoints = dealPoints
|
59 |
self.dealPoints = dealPoints
|
| - |
|
60 |
self.brand_id = brand_id
|
| 60 |
|
61 |
|
| 61 |
|
62 |
|
| 62 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
63 |
def get_mongo_connection(host=options.mongoHost, port=27017):
|
| 63 |
global con
|
64 |
global con
|
| 64 |
if con is None:
|
65 |
if con is None:
|
| Line 84... |
Line 85... |
| 84 |
#topSkus = collection.find( {'_id':664})
|
85 |
#topSkus = collection.find( {'_id':664})
|
| 85 |
for sku in topSkus:
|
86 |
for sku in topSkus:
|
| 86 |
"""Fix this """
|
87 |
"""Fix this """
|
| 87 |
#TODO Compute deal flags else where.
|
88 |
#TODO Compute deal flags else where.
|
| 88 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
89 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
| 89 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0)
|
90 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0, sku['brand_id'])
|
| 90 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'sku':info._id}, {'overrideNlc':1} ]} ))
|
91 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'sku':info._id}, {'overrideNlc':1} ]} ))
|
| 91 |
if len(exceptionalNlc) > 0:
|
92 |
if len(exceptionalNlc) > 0:
|
| 92 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
93 |
"""Exceptional nlc found, no need to calculate max and min R-nlc"""
|
| 93 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
94 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
| 94 |
info.minNlc = exceptionalNlc[0]['minNlc']
|
95 |
info.minNlc = exceptionalNlc[0]['minNlc']
|