Subversion Repositories SmartDukaan

Rev

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

Rev 14180 Rev 14181
Line 72... Line 72...
72
    json_input = response.read()
72
    json_input = response.read()
73
    if len(json_input) > 0:
73
    if len(json_input) > 0:
74
        vendorInfo = json.loads(json_input)
74
        vendorInfo = json.loads(json_input)
75
        for vendor in vendorInfo:
75
        for vendor in vendorInfo:
76
            lowestOfferPrice = float(vendor['sellingPrice'])
76
            lowestOfferPrice = float(vendor['sellingPrice'])
-
 
77
            try:
77
            stock = vendor['buyableInventory']
78
                stock = vendor['buyableInventory']
-
 
79
            except:
-
 
80
                stock = 0
78
            if stock > 0 and lowestOfferPrice > 0:
81
            if stock > 0 and lowestOfferPrice > 0:
79
                instock = 1
82
                instock = 1
80
                break
83
                break
-
 
84
    else:
-
 
85
        lowestOfferPrice = 0
81
                
86
        stock = 0
-
 
87
        instock = 0
-
 
88
        
82
    print lowestOfferPrice
89
    print lowestOfferPrice
83
    print instock
90
    print instock
84
    print stock
91
    print stock
-
 
92
    print "Lowest Offer Price for id %d is %d , stock is %d and stock count is %d" %(data['_id'],lowestOfferPrice,instock,stock)
85
    print "*************"
93
    print "*************"
86
    if instock  == 1:
94
    if instock  == 1:
87
        get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(datetime.now()),'priceUpdatedOn':to_java_date(datetime.now()),'in_stock':instock}}, multi=True)
95
        get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(datetime.now()),'priceUpdatedOn':to_java_date(datetime.now()),'in_stock':instock}}, multi=True)
88
        get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice , 'in_stock':instock}}, multi=True)
96
        get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice , 'in_stock':instock}}, multi=True)
89
    else:
97
    else: