| Line 12... |
Line 12... |
| 12 |
con = None
|
12 |
con = None
|
| 13 |
|
13 |
|
| 14 |
class __SkuInfo:
|
14 |
class __SkuInfo:
|
| 15 |
|
15 |
|
| 16 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
16 |
def __init__(self, _id, skuBundleId, category_id, mrp, available_price, source_id, rank, maxNlc, minNlc, schemeAmount, minDiscount, \
|
| 17 |
maxDiscount, discountType, dp, nlcPoints, bestSellerPoints, totalPoints,in_stock, maxPrice,showDeal):
|
17 |
maxDiscount, discountType, dp, nlcPoints, bestSellerPoints, totalPoints,in_stock,maxprice,showDeal):
|
| 18 |
self._id = _id
|
18 |
self._id = _id
|
| 19 |
self.skuBundleId = skuBundleId
|
19 |
self.skuBundleId = skuBundleId
|
| 20 |
self.category_id = category_id
|
20 |
self.category_id = category_id
|
| 21 |
self.mrp = mrp
|
21 |
self.mrp = mrp
|
| 22 |
self.available_price = available_price
|
22 |
self.available_price = available_price
|
| Line 31... |
Line 31... |
| 31 |
self.dp = dp
|
31 |
self.dp = dp
|
| 32 |
self.nlcPoints = nlcPoints
|
32 |
self.nlcPoints = nlcPoints
|
| 33 |
self.bestSellerPoints = bestSellerPoints
|
33 |
self.bestSellerPoints = bestSellerPoints
|
| 34 |
self.totalPoints = totalPoints
|
34 |
self.totalPoints = totalPoints
|
| 35 |
self.in_stock = in_stock
|
35 |
self.in_stock = in_stock
|
| 36 |
self.maxPrice = maxPrice
|
36 |
self.maxprice = maxprice
|
| 37 |
self.showDeal = showDeal
|
37 |
self.showDeal = showDeal
|
| 38 |
|
38 |
|
| 39 |
def get_mongo_connection(host='localhost', port=27017):
|
39 |
def get_mongo_connection(host='localhost', port=27017):
|
| 40 |
global con
|
40 |
global con
|
| 41 |
if con is None:
|
41 |
if con is None:
|
| Line 52... |
Line 52... |
| 52 |
data = get_mongo_connection().Catalog.Deals.find().sort([('totalPoints',pymongo.DESCENDING)])
|
52 |
data = get_mongo_connection().Catalog.Deals.find().sort([('totalPoints',pymongo.DESCENDING)])
|
| 53 |
print data.count()
|
53 |
print data.count()
|
| 54 |
for x in data:
|
54 |
for x in data:
|
| 55 |
s_info = __SkuInfo(x['_id'], x['skuBundleId'], x['category_id'],x['mrp'],x['available_price'],x['source_id'],x['rank'],x['maxNlc'], \
|
55 |
s_info = __SkuInfo(x['_id'], x['skuBundleId'], x['category_id'],x['mrp'],x['available_price'],x['source_id'],x['rank'],x['maxNlc'], \
|
| 56 |
x['minNlc'], x['schemeAmount'],x['minDiscount'],x['maxDiscount'],x['discountType'],x['dp'],x['nlcPoints'],x['bestSellerPoints'], \
|
56 |
x['minNlc'], x['schemeAmount'],x['minDiscount'],x['maxDiscount'],x['discountType'],x['dp'],x['nlcPoints'],x['bestSellerPoints'], \
|
| 57 |
x['totalPoints'],x['in_stock'],x['maxPrice'],x['showDeal'])
|
57 |
x['totalPoints'],x['in_stock'],x['maxprice'],x['showDeal'])
|
| 58 |
p.append(s_info)
|
58 |
p.append(s_info)
|
| 59 |
|
59 |
|
| 60 |
wbk = xlwt.Workbook()
|
60 |
wbk = xlwt.Workbook()
|
| 61 |
sheet = wbk.add_sheet('Deals')
|
61 |
sheet = wbk.add_sheet('Deals')
|
| 62 |
xstr = lambda s: s or ""
|
62 |
xstr = lambda s: s or ""
|
| Line 126... |
Line 126... |
| 126 |
sheet.write(it, 16, x.discountType)
|
126 |
sheet.write(it, 16, x.discountType)
|
| 127 |
sheet.write(it, 17, x.minDiscount)
|
127 |
sheet.write(it, 17, x.minDiscount)
|
| 128 |
sheet.write(it, 18, x.maxDiscount)
|
128 |
sheet.write(it, 18, x.maxDiscount)
|
| 129 |
sheet.write(it, 19, x.maxNlc)
|
129 |
sheet.write(it, 19, x.maxNlc)
|
| 130 |
sheet.write(it, 20, x.minNlc)
|
130 |
sheet.write(it, 20, x.minNlc)
|
| 131 |
sheet.write(it, 21, x.maxPrice)
|
131 |
sheet.write(it, 21, x.maxprice)
|
| 132 |
sheet.write(it, 22, x.rank)
|
132 |
sheet.write(it, 22, x.rank)
|
| 133 |
sheet.write(it, 23, x.nlcPoints)
|
133 |
sheet.write(it, 23, x.nlcPoints)
|
| 134 |
sheet.write(it, 24, x.bestSellerPoints)
|
134 |
sheet.write(it, 24, x.bestSellerPoints)
|
| 135 |
sheet.write(it, 25, x.totalPoints)
|
135 |
sheet.write(it, 25, x.totalPoints)
|
| 136 |
sheet.write(it, 26, x.showDeal)
|
136 |
sheet.write(it, 26, x.showDeal)
|