Subversion Repositories SmartDukaan

Rev

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

Rev 16024 Rev 16026
Line 409... Line 409...
409
    print "Done with recomputing"
409
    print "Done with recomputing"
410
 
410
 
411
def getLatestPrice(skuBundleId, source_id):
411
def getLatestPrice(skuBundleId, source_id):
412
    temp = []
412
    temp = []
413
    itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId,'source_id' : source_id}))
413
    itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId,'source_id' : source_id}))
-
 
414
    item = None
414
    for item in itemIds:
415
    for item in itemIds:
415
        item['dealFlag'] = 0
416
        item['dealFlag'] = 0
416
        item['dealType'] = 0
417
        item['dealType'] = 0
417
        item['dealPoints'] = 0
418
        item['dealPoints'] = 0
418
        item['manualDealThresholdPrice'] = None
419
        item['manualDealThresholdPrice'] = None
Line 446... Line 447...
446
            print "Error calculating cashback."
447
            print "Error calculating cashback."
447
            info['cash_back_type'] = 0
448
            info['cash_back_type'] = 0
448
            info['cash_back'] = 0
449
            info['cash_back'] = 0
449
        print "info is ",info
450
        print "info is ",info
450
        temp.append(info)
451
        temp.append(info)
-
 
452
    if item is not None:
451
    try:
453
        try:
452
        thread = threading.Thread(target=recomputeDeal, args = (item,))
454
            thread = threading.Thread(target=recomputeDeal, args = (item,))
453
        thread.daemon = True
455
            thread.daemon = True
454
        thread.start()    
456
            thread.start()    
455
    except:
457
        except:
456
        print traceback.print_exc()
458
            print traceback.print_exc()
457
        print "Unable to compute deal for ",skuBundleId
459
            print "Unable to compute deal for ",skuBundleId
458
    return temp
460
    return temp
459
 
461
 
460
def getLatestPriceById(id):
462
def getLatestPriceById(id):
461
    item = list(get_mongo_connection().Catalog.MasterData.find({'_id':id}))
463
    item = list(get_mongo_connection().Catalog.MasterData.find({'_id':id}))
462
    item[0]['dealFlag'] = 0
464
    item[0]['dealFlag'] = 0