Subversion Repositories SmartDukaan

Rev

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

Rev 17675 Rev 17678
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, subCategoryId):
50
                 codAvailable,showDp,gross_price, subCategoryId,subCategory):
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 72... Line 72...
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
        self.subCategoryId = subCategoryId
-
 
77
        self.subCategory = subCategory
77
 
78
 
78
 
79
 
79
def get_mongo_connection(host=options.mongoHost, port=27017):
80
def get_mongo_connection(host=options.mongoHost, port=27017):
80
    global con
81
    global con
81
    if con is None:
82
    if con is None:
Line 101... Line 102...
101
        #topSkus = collection.find( {'_id':664})
102
        #topSkus = collection.find( {'_id':664})
102
        for sku in topSkus:
103
        for sku in topSkus:
103
            """Fix this """
104
            """Fix this """
104
            #TODO Compute deal flags else where.
105
            #TODO Compute deal flags else where.
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, \
106
            info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
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'])
107
                             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'], \
-
 
108
                             sku['subCategory'])
107
            exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
109
            exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
108
            if len(exceptionalNlc) > 0:
110
            if len(exceptionalNlc) > 0:
109
                """Exceptional nlc found, no need to calculate max and min R-nlc"""
111
                """Exceptional nlc found, no need to calculate max and min R-nlc"""
110
                info.maxNlc = exceptionalNlc[0]['maxNlc']
112
                info.maxNlc = exceptionalNlc[0]['maxNlc']
111
                info.minNlc = exceptionalNlc[0]['minNlc']
113
                info.minNlc = exceptionalNlc[0]['minNlc']