Subversion Repositories SmartDukaan

Rev

Rev 14741 | Rev 14842 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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