Subversion Repositories SmartDukaan

Rev

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

Rev 22268 Rev 22269
Line 1430... Line 1430...
1430
    if source=="online":
1430
    if source=="online":
1431
        sourceToFilter =   ONLINE_DEAL_SOURCE_MAP.keys()  #filter categores on basis of source and tags
1431
        sourceToFilter =   ONLINE_DEAL_SOURCE_MAP.keys()  #filter categores on basis of source and tags
1432
    #For saholic specific deals
1432
    #For saholic specific deals
1433
    elif source=="deals":
1433
    elif source=="deals":
1434
        sourceToFilter = [4]
1434
        sourceToFilter = [4]
-
 
1435
        
-
 
1436
    if filterData:
1435
    filterArray = filterData.split('|')
1437
        filterArray = filterData.split('|')
1436
    for data in filterArray:
1438
        for data in filterArray:
1437
        try:
1439
            try:
1438
            filter, info = data.split(':')
1440
                filter, info = data.split(':')
1439
        except Exception as ex:
1441
            except Exception as ex:
1440
            traceback.print_exc()
1442
                traceback.print_exc()
1441
            continue
1443
                continue
1442
        if filter == 'brandFilter':
1444
            if filter == 'brandFilter':
1443
            brandsToFilter = info.split('^')
1445
                brandsToFilter = info.split('^')
1444
        if filter == 'subCategoryFilter':
1446
            if filter == 'subCategoryFilter':
1445
            subCategoryToFilter = info.split('^')
1447
                subCategoryToFilter = info.split('^')
1446
        if filter == 'priceFilter':
1448
            if filter == 'priceFilter':
1447
            priceToFilter = info.split('^')
1449
                priceToFilter = info.split('^')
1448
        if filter == 'sourceFilter':
1450
            if filter == 'sourceFilter':
1449
            sourceToFilter = sourceToFilter + info.split('^')
1451
                sourceToFilter = sourceToFilter + info.split('^')
1450
                
1452
                    
1451
    if brandsToFilter:
1453
    if brandsToFilter:
1452
        temp = []    
1454
        temp = []    
1453
        for deal in deals:
1455
        for deal in deals:
1454
            if str(int(deal['brand_id'])) in brandsToFilter:
1456
            if str(int(deal['brand_id'])) in brandsToFilter:
1455
                temp.append(deal)
1457
                temp.append(deal)
1456
        deals = temp
1458
        deals = temp
1457
    
1459
 
1458
    print "Length deals after brandfilter ", len(deals)
1460
    print "Length deals after brandfilter ", len(deals)
1459
    
1461
    
1460
    if subCategoryToFilter:
1462
    if subCategoryToFilter:
1461
        temp = []
1463
        temp = []
1462
        for deal in deals:
1464
        for deal in deals:
1463
            if str(int(deal['subCategoryId'])) in subCategoryToFilter:
1465
            if str(int(deal['subCategoryId'])) in subCategoryToFilter:
1464
                temp.append(deal)
1466
                temp.append(deal)
1465
        deals = temp
1467
        deals = temp
1466
    
1468
    
1467
    print "Length deals after subCatfilter ", len(deals)
1469
    print "Length deals after subCatfilter ", len(deals)
1468
    
1470
        
1469
    if sourceToFilter:
1471
    if sourceToFilter:
1470
        temp = []
1472
        temp = []
1471
        for deal in deals:
1473
        for deal in deals:
1472
            if str(int(deal['source_id'])) in sourceToFilter:
1474
            if str(int(deal['source_id'])) in sourceToFilter:
1473
                temp.append(deal)
1475
                temp.append(deal)
Line 1480... Line 1482...
1480
        temp = []
1482
        temp = []
1481
        for deal in deals:
1483
        for deal in deals:
1482
            if deal.get('available_price') > float(priceToFilter[0]) and deal.get('available_price') <= float(priceToFilter[1]):
1484
            if deal.get('available_price') > float(priceToFilter[0]) and deal.get('available_price') <= float(priceToFilter[1]):
1483
                temp.append(deal)
1485
                temp.append(deal)
1484
        deals = temp
1486
        deals = temp
1485
    
1487
        
1486
    print "Length deals after price filter ", len(deals)
1488
        print "Length deals after price filter ", len(deals)
1487
                
1489
                
1488
    return [trend['skuBundleId'] for trend in temp]
1490
    return [trend['skuBundleId'] for trend in temp]
1489
 
1491
 
1490
def getDeals(userId, category_id, offset, limit, sort, direction):
1492
def getDeals(userId, category_id, offset, limit, sort, direction):
1491
    if mc.get("category_cash_back") is None or not bool(mc.get("category_cash_back")):
1493
    if mc.get("category_cash_back") is None or not bool(mc.get("category_cash_back")):