Subversion Repositories SmartDukaan

Rev

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

Rev 14129 Rev 14130
Line 45... Line 45...
45
                dealsMap[active_private_deal.item_id] = active_private_deal
45
                dealsMap[active_private_deal.item_id] = active_private_deal
46
 
46
 
47
def getItemsToUpdate():
47
def getItemsToUpdate():
48
    global dealsCatalogIds
48
    global dealsCatalogIds
49
    global itemCatalogMap
49
    global itemCatalogMap
50
    saholicCatalogIds = list(get_mongo_connection().Catalog.MasterData.find({'rank':{"$gt":0}}))
50
    bestSellers = list(get_mongo_connection().Catalog.MasterData.find({'rank':{"$gt":0}}))
-
 
51
    for bestSeller in bestSellers: 
-
 
52
        saholicCatalogIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bestSeller['skuBundleId'],'source_id':4}))
51
    for d in saholicCatalogIds:
53
        for d in saholicCatalogIds:
52
        if d['source_id']!=4:
54
            if d['source_id']!=4:
53
            continue
55
                continue
54
        dealsCatalogIds.append(long(d['identifier'].strip()))
56
            dealsCatalogIds.append(long(d['identifier'].strip()))
55
    items = Item.query.filter(Item.catalog_item_id.in_(dealsCatalogIds)).all()
57
    items = Item.query.filter(Item.catalog_item_id.in_(dealsCatalogIds)).all()
56
    for item in items:
58
    for item in items:
57
        temp = []
59
        temp = []
58
        if not itemCatalogMap.has_key(item.catalog_item_id):
60
        if not itemCatalogMap.has_key(item.catalog_item_id):
59
            temp.append(item)
61
            temp.append(item)
Line 64... Line 66...
64
            for l in val:
66
            for l in val:
65
                temp.append(l)
67
                temp.append(l)
66
            temp.append(item)
68
            temp.append(item)
67
            itemCatalogMap[item.catalog_item_id] = temp
69
            itemCatalogMap[item.catalog_item_id] = temp
68
            
70
            
69
    for saholicCatalogId in saholicCatalogIds:
71
    for saholicCatalogId in bestSellers:
70
        if saholicCatalogId['source_id']!=4:
72
        if saholicCatalogId['source_id']!=4:
71
            continue
73
            continue
72
        d_items = itemCatalogMap.get(long(saholicCatalogId['identifier'].strip()))
74
        d_items = itemCatalogMap.get(long(saholicCatalogId['identifier'].strip()))
73
        available_price = None
75
        available_price = None
74
        for d_item in d_items: 
76
        for d_item in d_items: