| Line 709... |
Line 709... |
| 709 |
pseudo_count = 0
|
709 |
pseudo_count = 0
|
| 710 |
|
710 |
|
| 711 |
if actionsMap:
|
711 |
if actionsMap:
|
| 712 |
for k,v in actionsMap.iteritems():
|
712 |
for k,v in actionsMap.iteritems():
|
| 713 |
tmp_deal = get_mongo_connection().Catalog.Deals.find_one({'_id':k})
|
713 |
tmp_deal = get_mongo_connection().Catalog.Deals.find_one({'_id':k})
|
| - |
|
714 |
print tmp_deal
|
| 714 |
if tmp_deal is None or tmp_deal['category_id']!=6 or tmp_deal['showDeal']!=1 or tmp_deal['prepaidDeal']!=1 :
|
715 |
if tmp_deal is None and tmp_deal['category_id']!=6 and (tmp_deal['showDeal']!=1 or tmp_deal['prepaidDeal']!=1) :
|
| - |
|
716 |
print "Continue"
|
| 715 |
v['rank'] = None
|
717 |
v['rank'] = None
|
| 716 |
continue
|
718 |
continue
|
| 717 |
if v['action'] ==0:
|
719 |
if v['action'] ==0:
|
| 718 |
leastDealRankPoints = list(get_mongo_connection().Catalog.Deals.find({'subCategoryId':tmp_deal.get('subCategoryId')}).sort([('dealRankPoints',pymongo.ASCENDING)]).limit(1))
|
720 |
leastDealRankPoints = list(get_mongo_connection().Catalog.Deals.find({'subCategoryId':tmp_deal.get('subCategoryId')}).sort([('dealRankPoints',pymongo.ASCENDING)]).limit(1))
|
| 719 |
if len(leastDealRankPoints) == 0 or leastDealRankPoints[0].get('dealRankPoints') is None:
|
721 |
if len(leastDealRankPoints) == 0 or leastDealRankPoints[0].get('dealRankPoints') is None:
|
| - |
|
722 |
print "Continue2"
|
| 720 |
v['rank'] = None
|
723 |
v['rank'] = None
|
| 721 |
continue
|
724 |
continue
|
| 722 |
v['dealRankPoints'] = leastDealRankPoints[0]['leastDealRankPoints'] - 1
|
725 |
v['dealRankPoints'] = leastDealRankPoints[0]['dealRankPoints'] - 1
|
| 723 |
v['rank'] = 999999
|
726 |
v['rank'] = 999999
|
| 724 |
else:
|
727 |
else:
|
| 725 |
v['dealRankPoints'] = tmp_deal.get('dealRankPoints')
|
728 |
v['dealRankPoints'] = tmp_deal.get('dealRankPoints')
|
| 726 |
|
729 |
|
| 727 |
for deal in accessories_deals:
|
730 |
for deal in accessories_deals:
|
| Line 732... |
Line 735... |
| 732 |
pass
|
735 |
pass
|
| 733 |
if actionsMap and actionsMap.get(deal['_id'])!=None:
|
736 |
if actionsMap and actionsMap.get(deal['_id'])!=None:
|
| 734 |
if actionsMap.get(deal['_id']).get('action') ==1 and actionsMap.get(deal['_id']).get('rank')!=None:
|
737 |
if actionsMap.get(deal['_id']).get('action') ==1 and actionsMap.get(deal['_id']).get('rank')!=None:
|
| 735 |
actionRank = actionsMap.get(deal['_id']).get('rank')
|
738 |
actionRank = actionsMap.get(deal['_id']).get('rank')
|
| 736 |
if actionRank < pseudo_count:
|
739 |
if actionRank < pseudo_count:
|
| 737 |
deal['dealRankPoints'] = accessories_deals[actionRank-1]['dealRankPoints'] -.5 - pseudo_count
|
740 |
deal['dealRankPoints'] = accessories_deals[actionRank-1]['dealRankPoints'] +.5 + pseudo_count
|
| 738 |
pseudo_count = pseudo_count+1
|
741 |
pseudo_count = pseudo_count+1
|
| 739 |
elif actionsMap.get(deal['_id']).get('action') ==0 and actionsMap.get(deal['_id']).get('rank')!=None:
|
742 |
elif actionsMap.get(deal['_id']).get('action') ==0 and actionsMap.get(deal['_id']).get('rank')!=None:
|
| 740 |
deal['dealRankPoints'] = actionsMap.get(deal['_id']).get('dealRankPoints')
|
743 |
deal['dealRankPoints'] = actionsMap.get(deal['_id']).get('dealRankPoints')
|
| 741 |
else:
|
744 |
else:
|
| 742 |
pass
|
745 |
pass
|
| - |
|
746 |
for k, v in actionsMap.iteritems():
|
| - |
|
747 |
print k,
|
| - |
|
748 |
print '\t',
|
| - |
|
749 |
print v
|
| 743 |
|
750 |
|
| 744 |
accessories_deals = sorted(accessories_deals, key = lambda x: (x['dealRankPoints'],x['bestSellerPoints'], x['nlcPoints'], x['rank']),reverse=True)
|
751 |
accessories_deals = sorted(accessories_deals, key = lambda x: (x['dealRankPoints'],x['bestSellerPoints'], x['nlcPoints'], x['rank']),reverse=True)
|
| 745 |
|
752 |
|
| 746 |
if len(fd_bundles) > 0:
|
753 |
if len(fd_bundles) > 0:
|
| 747 |
print "There is still bundle in feature deals.Lets add info"
|
754 |
print "There is still bundle in feature deals.Lets add info"
|
| Line 3288... |
Line 3295... |
| 3288 |
finally:
|
3295 |
finally:
|
| 3289 |
session.close()
|
3296 |
session.close()
|
| 3290 |
return result
|
3297 |
return result
|
| 3291 |
|
3298 |
|
| 3292 |
def main():
|
3299 |
def main():
|
| 3293 |
#getDealsForSearchText("20", 'Samsung', 0, 10)
|
3300 |
getAccesoryDeals(47, 6, 0, 20, None, None, None)
|
| 3294 |
|
- |
|
| 3295 |
x = getBrandSubCategoryInfo(6,"15^17","subCategoryInfo")
|
- |
|
| 3296 |
print "==============="
|
- |
|
| 3297 |
print x
|
- |
|
| 3298 |
|
3301 |
|
| 3299 |
if __name__=='__main__':
|
3302 |
if __name__=='__main__':
|
| 3300 |
main()
|
3303 |
main()
|
| 3301 |
|
3304 |
|
| 3302 |
|
3305 |
|