Subversion Repositories SmartDukaan

Rev

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

Rev 18830 Rev 19135
Line 402... Line 402...
402
    all_deals = list(get_mongo_connection().Catalog.Deals.find({"$and":outer_query},{'_id':1,'category_id':1,'brand':1,'totalPoints':1,'bestSellerPoints':1,'nlcPoints':1,'rank':1,'available_price':1,'dealType':1,'source_id':1,'brand_id':1,'skuBundleId':1,'dp':1, 'showDp':1, 'gross_price':1, 'subCategoryId':1}).sort([('totalPoints',pymongo.DESCENDING),('bestSellerPoints',pymongo.DESCENDING),('nlcPoints',pymongo.DESCENDING),('rank',pymongo.DESCENDING)]))
402
    all_deals = list(get_mongo_connection().Catalog.Deals.find({"$and":outer_query},{'_id':1,'category_id':1,'brand':1,'totalPoints':1,'bestSellerPoints':1,'nlcPoints':1,'rank':1,'available_price':1,'dealType':1,'source_id':1,'brand_id':1,'skuBundleId':1,'dp':1, 'showDp':1, 'gross_price':1, 'subCategoryId':1}).sort([('totalPoints',pymongo.DESCENDING),('bestSellerPoints',pymongo.DESCENDING),('nlcPoints',pymongo.DESCENDING),('rank',pymongo.DESCENDING)]))
403
    mobile_deals = []
403
    mobile_deals = []
404
    tablet_deals = []
404
    tablet_deals = []
405
    accessories_deals = []
405
    accessories_deals = []
406
    for deal in all_deals:
406
    for deal in all_deals:
407
        
-
 
408
        
407
 
409
        try:
408
        try:
410
            fd_bundles.remove(deal.get('skuBundleId'))
409
            fd_bundles.remove(deal.get('skuBundleId'))
411
        except:
410
        except:
412
            pass
411
            pass
413
        
412
        
Line 1841... Line 1840...
1841
                        item[0]['availabilityInfo'] = [{}]
1840
                        item[0]['availabilityInfo'] = [{}]
1842
                    else:
1841
                    else:
1843
                        item[0]['availabilityInfo'] = item_availability_info
1842
                        item[0]['availabilityInfo'] = item_availability_info
1844
            except:
1843
            except:
1845
                item[0]['availabilityInfo'] = [{}]
1844
                item[0]['availabilityInfo'] = [{}]
-
 
1845
            
-
 
1846
            item[0]['totalPoints'] = d['totalPoints']
1846
        
1847
        
1847
            temp.append(item[0])
1848
            temp.append(item[0])
1848
        if len(temp) > 1:
1849
        if len(temp) > 1:
1849
            temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
1850
            temp = sorted(temp, key = lambda x: (x['available_price']),reverse=False)
1850
        dealsListMap.append(temp)
1851
        dealsListMap.append(temp)
Line 2424... Line 2425...
2424
                    }
2425
                    }
2425
                }
2426
                }
2426
 
2427
 
2427
            ]
2428
            ]
2428
        }
2429
        }
2429
    }
2430
    },
-
 
2431
    "sort": { "dealPoints": { "order": "desc" }}
2430
}
2432
}
2431
    result =  get_elastic_search_connection().search(index="my_index", body=payload, from_=offset, size=limit)
2433
    result =  get_elastic_search_connection().search(index="my_index", body=payload, from_=offset, size=limit)
2432
    totalCount= result['hits']['total']
2434
    totalCount= result['hits']['total']
2433
    temp = []
2435
    temp = []
2434
    bundles = []
2436
    bundles = []
Line 2552... Line 2554...
2552
        item[0]['availabilityInfo'] = [{}]
2554
        item[0]['availabilityInfo'] = [{}]
2553
    return item[0]
2555
    return item[0]
2554
 
2556
 
2555
            
2557
            
2556
def main():
2558
def main():
2557
    print datetime.now()
-
 
2558
    getNewDeals(47, 6, 0, 20, None, None, None)
2559
    getDealsForSearchText("20", 'Samsung', 0, 10)
2559
    print datetime.now()
-
 
2560
    
2560
    
2561
if __name__=='__main__':
2561
if __name__=='__main__':
2562
    main()
2562
    main()
2563
 
2563
 
2564
 
2564