| Line 619... |
Line 619... |
| 619 |
category_id = skuData[0]['category_id']
|
619 |
category_id = skuData[0]['category_id']
|
| 620 |
category_specific_deals = user_specific_deals.get(category_id)
|
620 |
category_specific_deals = user_specific_deals.get(category_id)
|
| 621 |
if category_specific_deals is None or len(category_specific_deals) ==0:
|
621 |
if category_specific_deals is None or len(category_specific_deals) ==0:
|
| 622 |
return {'rank':0,'description':'Category specific deals is empty'}
|
622 |
return {'rank':0,'description':'Category specific deals is empty'}
|
| 623 |
sorted_deals = sorted(category_specific_deals, key = lambda x: (x['persPoints'],x['totalPoints'],x['bestSellerPoints'], x['nlcPoints'], x['rank']),reverse=True)
|
623 |
sorted_deals = sorted(category_specific_deals, key = lambda x: (x['persPoints'],x['totalPoints'],x['bestSellerPoints'], x['nlcPoints'], x['rank']),reverse=True)
|
| - |
|
624 |
sortedMap = {}
|
| - |
|
625 |
rankMap = {}
|
| 624 |
rank = 1
|
626 |
rank = 0
|
| 625 |
for sorted_deal in sorted_deals:
|
627 |
for sorted_deal in sorted_deals:
|
| - |
|
628 |
if sortedMap.get(sorted_deal['skuBundleId']) is None:
|
| 626 |
if sorted_deal['skuBundleId'] == skuData[0]['skuBundleId']:
|
629 |
sortedMap[sorted_deal['skuBundleId']] = {rank:[sorted_deal]}
|
| - |
|
630 |
rankMap[rank] = (sortedMap[sorted_deal['skuBundleId']].values())[0]
|
| - |
|
631 |
rank = rank +1
|
| - |
|
632 |
else:
|
| - |
|
633 |
for temp_list in sortedMap.get(sorted_deal['skuBundleId']).itervalues():
|
| - |
|
634 |
temp_list.append(sorted_deal)
|
| - |
|
635 |
rankMap[(sortedMap.get(sorted_deal['skuBundleId']).keys())[0]] = temp_list
|
| - |
|
636 |
|
| - |
|
637 |
for dealList in rankMap.iteritems():
|
| - |
|
638 |
rank = rank +1
|
| - |
|
639 |
for d in dealList:
|
| - |
|
640 |
if d['identifier'] == identifier and d['source_id'] == source_id:
|
| 627 |
return {'rank':rank, 'description':'Rank found'}
|
641 |
return {'rank':rank,'description':'Rank found'}
|
| 628 |
rank+=1
|
642 |
|
| 629 |
return {'rank':0,'description':'Rank not found'}
|
643 |
return {'rank':0,'description':'Rank not found'}
|
| 630 |
|
644 |
|
| 631 |
|
645 |
|
| 632 |
def getCashBackDetails(identifier, source_id):
|
646 |
def getCashBackDetails(identifier, source_id):
|
| 633 |
if not bool(mc.get("category_cash_back")):
|
647 |
if not bool(mc.get("category_cash_back")):
|