Subversion Repositories SmartDukaan

Rev

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

Rev 14035 Rev 14114
Line 216... Line 216...
216
                sku['bestSellerPoints'] = (bestSellerPoints[0]['points']) * bestSellerPoints[0]['weightage']
216
                sku['bestSellerPoints'] = (bestSellerPoints[0]['points']) * bestSellerPoints[0]['weightage']
217
            else:
217
            else:
218
                sku['bestSellerPoints'] = (bestSellerPoints[0]['points'])
218
                sku['bestSellerPoints'] = (bestSellerPoints[0]['points'])
219
        else:
219
        else:
220
            sku['bestSellerPoints'] = -100
220
            sku['bestSellerPoints'] = -100
221
        sku['totalPoints'] = sku['bestSellerPoints'] + sku['nlcPoints']
221
        #sku['totalPoints'] = sku['bestSellerPoints'] + sku['nlcPoints']
-
 
222
        get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'bestSellerPoints':sku['bestSellerPoints']}},multi=False)
-
 
223
    
-
 
224
    for sku in allItems:
-
 
225
        deal_item = list(get_mongo_connection().Catalog.Deals.find({'skuBundleId':sku['skuBundleId']}).sort('bestSellerPoints',pymongo.DESCENDING).limit(1))
-
 
226
        if deal_item[0]['source_id'] == 4:
-
 
227
            weight = .2
-
 
228
        else:
-
 
229
            weight = 1
-
 
230
        if deal_item[0]['bestSellerPoints'] > 0:
-
 
231
            sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints'] * weight
-
 
232
        else:
-
 
233
            sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints']
-
 
234
        
-
 
235
        sku['totalPoints'] = sku['catalogBestSellerPoints'] + sku['nlcPoints']
222
        get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'bestSellerPoints':sku['bestSellerPoints'],'totalPoints':sku['totalPoints']}},multi=False)
236
        get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'catalogBestSellerPoints':sku['catalogBestSellerPoints'],'totalPoints':sku['totalPoints']}},multi=False)
-
 
237
        
223
 
238
 
224
def elimiateSimilarDeals():
239
def elimiateSimilarDeals():
225
    allItems = get_mongo_connection().Catalog.Deals.find().distinct('skuBundleId')
240
    allItems = get_mongo_connection().Catalog.Deals.find().distinct('skuBundleId')
226
    for skuBundleId in allItems:
241
    for skuBundleId in allItems:
227
        print skuBundleId
242
        print skuBundleId