| Line 87... |
Line 87... |
| 87 |
for sku in topSkus:
|
87 |
for sku in topSkus:
|
| 88 |
"""Fix this """
|
88 |
"""Fix this """
|
| 89 |
#TODO Compute deal flags else where.
|
89 |
#TODO Compute deal flags else where.
|
| 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 |
info = __SkuInfo(sku['_id'], sku['skuBundleId'], sku['category_id'], sku['mrp'], sku['available_price'], sku['source_id'], sku['rank'], None, None, 0.0, None, \
|
| 91 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0, sku['brand_id'], None)
|
91 |
None, None, None, None, sku['status'], sku['in_stock'],sku['maxPrice'],sku['brand'].strip().upper(), 0, 0, sku['brand_id'], None)
|
| 92 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'sku':info._id}, {'overrideNlc':1} ]} ))
|
92 |
exceptionalNlc = list(get_mongo_connection().Catalog.ExceptionalNlc.find( {"$and" : [ {'skuBundleId':info.skuBundleId}, {'overrideNlc':1} ]} ))
|
| 93 |
if len(exceptionalNlc) > 0:
|
93 |
if len(exceptionalNlc) > 0:
|
| 94 |
"""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"""
|
| 95 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
95 |
info.maxNlc = exceptionalNlc[0]['maxNlc']
|
| 96 |
info.minNlc = exceptionalNlc[0]['minNlc']
|
96 |
info.minNlc = exceptionalNlc[0]['minNlc']
|
| 97 |
if info.maxprice == 0:
|
97 |
if info.maxprice == 0:
|
| 98 |
info.maxprice = exceptionalNlc[0]['maxNlc']
|
98 |
info.maxprice = exceptionalNlc[0]['maxNlc']
|
| 99 |
LATEST_UPDATED_ITEMS.append(info)
|
99 |
LATEST_UPDATED_ITEMS.append(info)
|
| 100 |
continue
|
100 |
continue
|
| 101 |
|
101 |
|
| 102 |
skuSchemeDetails = list(get_mongo_connection().Catalog.SkuSchemeDetails.find( {'sku':info._id}).sort([('addedOn',pymongo.DESCENDING)]).limit(1))
|
102 |
skuSchemeDetails = list(get_mongo_connection().Catalog.SkuSchemeDetails.find( {'skuBundleId':info.skuBundleId}))
|
| 103 |
if len(skuSchemeDetails) > 0:
|
103 |
if len(skuSchemeDetails) > 0:
|
| 104 |
"""Sku scheme details, populate scheme amount (Recently added)"""
|
104 |
"""Sku scheme details, populate scheme amount (Recently added)"""
|
| 105 |
|
105 |
|
| 106 |
#TODO Add start date and end date of scehems
|
106 |
#TODO Add start date and end date of scehems
|
| 107 |
|
107 |
|
| 108 |
info.schemeAmount = float(skuSchemeDetails[0]['schemeAmount'])
|
108 |
info.schemeAmount = float(skuSchemeDetails[0]['schemeAmount'])
|
| 109 |
|
109 |
|
| 110 |
skuDealerPrices = list(get_mongo_connection().Catalog.SkuDealerPrices.find( {'sku':info._id} ) )
|
110 |
skuDealerPrices = list(get_mongo_connection().Catalog.SkuDealerPrices.find( {'skuBundleId':info.skuBundleId} ) )
|
| 111 |
if len(skuDealerPrices) > 0:
|
111 |
if len(skuDealerPrices) > 0:
|
| 112 |
info.dp = skuDealerPrices[0]['dp']
|
112 |
info.dp = skuDealerPrices[0]['dp']
|
| 113 |
skuDiscount = list(get_mongo_connection().Catalog.SkuDiscountInfo.find( {'sku':info._id} ) )
|
113 |
skuDiscount = list(get_mongo_connection().Catalog.SkuDiscountInfo.find( {'skuBundleId':info.skuBundleId} ) )
|
| 114 |
if len(skuDiscount) > 0:
|
114 |
if len(skuDiscount) > 0:
|
| 115 |
"""Sku rule found, populate max , min Discount and discount type"""
|
115 |
"""Sku rule found, populate max , min Discount and discount type"""
|
| 116 |
info.maxDiscount = skuDiscount[0]['max_discount']
|
116 |
info.maxDiscount = skuDiscount[0]['max_discount']
|
| 117 |
info.minDiscount = skuDiscount[0]['min_discount']
|
117 |
info.minDiscount = skuDiscount[0]['min_discount']
|
| 118 |
info.discountType = DISCOUNT_TYPE.get(skuDiscount[0]['discountType'].upper())
|
118 |
info.discountType = DISCOUNT_TYPE.get(skuDiscount[0]['discountType'].upper())
|