Subversion Repositories SmartDukaan

Rev

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

Rev 23023 Rev 23337
Line 936... Line 936...
936
                filterData =  a[0] + sourceFiterString
936
                filterData =  a[0] + sourceFiterString
937
                b = a[1].split("|")
937
                b = a[1].split("|")
938
                if len(b) > 1:
938
                if len(b) > 1:
939
                    filterData = "|".join([filterData] + b[1:])
939
                    filterData = "|".join([filterData] + b[1:])
940
            else:
940
            else:
941
                filterData = a + "|" + sourceFiterString
941
                filterData = filterData + "|" + sourceFiterString
942
    
942
    
943
    dealsListMap = []
943
    dealsListMap = []
944
    user_specific_deals = mc.get(str(userId))
944
    user_specific_deals = mc.get(str(userId))
945
    if user_specific_deals is None:
945
    if user_specific_deals is None:
946
        __populateCache(userId)
946
        __populateCache(userId)
Line 979... Line 979...
979
            filtered_deals = filterDeals(category_specific_deals, filterData)
979
            filtered_deals = filterDeals(category_specific_deals, filterData)
980
            if len(filtered_deals)==0:
980
            if len(filtered_deals)==0:
981
                dataExist = False
981
                dataExist = False
982
        except:
982
        except:
983
            traceback.print_exc()
983
            traceback.print_exc()
-
 
984
 
984
    if dataExist:
985
    if dataExist:
985
    
-
 
986
        if not insert_featured_deals:
986
        if not insert_featured_deals:
987
            sortedMap = {}
987
            sortedMap = {}
988
            rankMap = {}
988
            rankMap = {}
989
            rank = 0
989
            rank = 0
990
            for sorted_deal in sorted_deals:
990
            for sorted_deal in sorted_deals:
Line 2267... Line 2267...
2267
def getBrandsForFilter(category_id):
2267
def getBrandsForFilter(category_id):
2268
    if mc.get("brandFilter") is None:
2268
    if mc.get("brandFilter") is None:
2269
        print "Populating brand data for category_id %d" %(category_id)
2269
        print "Populating brand data for category_id %d" %(category_id)
2270
        tabData, mobData, accData = [], [], []
2270
        tabData, mobData, accData = [], [], []
2271
        mobileDeals = get_mongo_connection().Catalog.Deals.aggregate([
2271
        mobileDeals = get_mongo_connection().Catalog.Deals.aggregate([
2272
                                                                      {"$match":{"category_id":3,"showDeal":1,"totalPoints":{"$gt":-100}}
2272
                                                                      {"$match":{"category_id":3,"showDeal":1,"totalPoints":{"$gt":-100}, "source_id":4}
2273
                                                                    },
2273
                                                                    },
2274
                                                                 {"$group" : 
2274
                                                                 {"$group" : 
2275
                                                                  {'_id':{'brand_id':'$brand_id','brand':'$brand'},'count':{'$sum':1}}
2275
                                                                  {'_id':{'brand_id':'$brand_id','brand':'$brand'},'count':{'$sum':1}}
2276
                                                                  }
2276
                                                                  }
2277
                                                                ])
2277
                                                                ])
2278
        
2278
        
2279
        tabletDeals = get_mongo_connection().Catalog.Deals.aggregate([
2279
        tabletDeals = get_mongo_connection().Catalog.Deals.aggregate([
2280
                                                                      {"$match":{"category_id":5,"showDeal":1,"totalPoints":{"$gt":-100}}
2280
                                                                      {"$match":{"category_id":5,"showDeal":1,"totalPoints":{"$gt":-100},  "source_id":4}
2281
                                                                    },
2281
                                                                    },
2282
                                                                 {"$group" : 
2282
                                                                 {"$group" : 
2283
                                                                  {'_id':{'brand_id':'$brand_id','brand':'$brand'},'count':{'$sum':1}}
2283
                                                                  {'_id':{'brand_id':'$brand_id','brand':'$brand'},'count':{'$sum':1}}
2284
                                                                  }
2284
                                                                  }
2285
                                                                ])
2285
                                                                ])