Subversion Repositories SmartDukaan

Rev

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

Rev 19559 Rev 19570
Line 685... Line 685...
685
    
685
    
686
    print "Populating accessory memcache for userId",userId
686
    print "Populating accessory memcache for userId",userId
687
    outer_query = []
687
    outer_query = []
688
    outer_query.append({ "$or": [ { "showDeal": 1} , { "prepaidDeal": 1 } ] })
688
    outer_query.append({ "$or": [ { "showDeal": 1} , { "prepaidDeal": 1 } ] })
689
    query = {}
689
    query = {}
690
    query['$gte'] = 0
690
    query['$gt'] = 0
691
    outer_query.append({'internalRank':query})
691
    outer_query.append({'internalRank':query})
692
    outer_query.append({'category_id':{"$in":[6]}})
692
    outer_query.append({'category_id':{"$in":[6]}})
693
 
693
 
694
    accessories_deals = list(get_mongo_connection().Catalog.Deals.find({"$and":outer_query},{'_id':1,'category_id':1,'brand':1,'bestSellerPoints':1,'nlcPoints':1,'totalPoints':1,'internalRank':1,'available_price':1,'dealType':1,'source_id':1,'brand_id':1,'skuBundleId':1,'dp':1, 'showDp':1, 'gross_price':1, 'subCategoryId':1,'netPriceAfterCashBack':1}).sort([('internalRank',pymongo.ASCENDING),('bestSellerPoints',pymongo.DESCENDING)]))
694
    accessories_deals = list(get_mongo_connection().Catalog.Deals.find({"$and":outer_query},{'_id':1,'category_id':1,'brand':1,'bestSellerPoints':1,'nlcPoints':1,'totalPoints':1,'internalRank':1,'available_price':1,'dealType':1,'source_id':1,'brand_id':1,'skuBundleId':1,'dp':1, 'showDp':1, 'gross_price':1, 'subCategoryId':1,'netPriceAfterCashBack':1}).sort([('internalRank',pymongo.ASCENDING),('bestSellerPoints',pymongo.DESCENDING)]))
695
    
695
    
Line 1228... Line 1228...
1228
            continue
1228
            continue
1229
        for d in dealList:
1229
        for d in dealList:
1230
            item = list(get_mongo_connection().Catalog.MasterData.find({'_id':d['_id']}))
1230
            item = list(get_mongo_connection().Catalog.MasterData.find({'_id':d['_id']}))
1231
            if len(item) ==0:
1231
            if len(item) ==0:
1232
                continue
1232
                continue
-
 
1233
            item[0]['internalRankDeals'] = d.get('internalRank')
1233
            if d['dealType'] == 1 and d['source_id'] ==1:
1234
            if d['dealType'] == 1 and d['source_id'] ==1:
1234
                try:
1235
                try:
1235
                    manualDeal = list(get_mongo_connection().Catalog.ManualDeals.find({'sku':d['_id'],'startDate':{'$lte':to_java_date(datetime.now())},'endDate':{'$gte':to_java_date(datetime.now())}}))
1236
                    manualDeal = list(get_mongo_connection().Catalog.ManualDeals.find({'sku':d['_id'],'startDate':{'$lte':to_java_date(datetime.now())},'endDate':{'$gte':to_java_date(datetime.now())}}))
1236
                    item[0]['marketPlaceUrl'] = manualDeal[0]['dealUrl'].strip()
1237
                    item[0]['marketPlaceUrl'] = manualDeal[0]['dealUrl'].strip()
1237
                except:
1238
                except:
Line 2940... Line 2941...
2940
                }
2941
                }
2941
 
2942
 
2942
            ]
2943
            ]
2943
        }
2944
        }
2944
    },
2945
    },
2945
    "sort": { "dealPoints": { "order": "desc" }}
2946
    "sort": { "internalRank": { "order": "asc" }}
2946
}
2947
}
2947
    result =  get_elastic_search_connection().search(index="my_index", body=payload, from_=offset, size=limit)
2948
    result =  get_elastic_search_connection().search(index="my_index", body=payload, from_=offset, size=limit)
2948
    totalCount= result['hits']['total']
2949
    totalCount= result['hits']['total']
2949
    temp = []
2950
    temp = []
2950
    bundles = []
2951
    bundles = []