Subversion Repositories SmartDukaan

Rev

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

Rev 17295 Rev 17456
Line 121... Line 121...
121
                    print "sku id is already updated",data['_id'] 
121
                    print "sku id is already updated",data['_id'] 
122
                    return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
122
                    return {'_id':data['_id'],'available_price':data['available_price'],'in_stock':data['in_stock'],'source_id':4,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'], 'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
123
            except:
123
            except:
124
                pass
124
                pass
125
            
125
            
126
            url = "http://50.116.3.101:8080/mobileapi/dtr-pricing?id=%s"%(data['identifier'])
126
            url = "http://173.255.209.200:8080/mobileapi/dtr-pricing?id=%s"%(data['identifier'])
127
            lowestPrice = 0.0
127
            lowestPrice = 0.0
128
            instock = 0
128
            instock = 0
129
            req = urllib2.Request(url,headers=headers)
129
            req = urllib2.Request(url,headers=headers)
130
            response = urllib2.urlopen(req)
130
            response = urllib2.urlopen(req)
131
            json_input = response.read()
131
            json_input = response.read()
132
            response.close()
132
            response.close()
133
            priceInfo = json.loads(json_input)
133
            priceInfo = json.loads(json_input)
-
 
134
            print "PriceInfo ",data['identifier']
-
 
135
            print priceInfo
134
            lowestPrice = priceInfo['response']['sellingPrice']
136
            lowestPrice = priceInfo['response']['sellingPrice']
135
            if lowestPrice > 0:
137
            if lowestPrice > 0:
136
                instock = 1
138
                instock = 1
137
            if instock  == 1:
139
            if instock  == 1:
138
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestPrice,'updatedOn':to_java_date(now),'priceUpdatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
140
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestPrice,'updatedOn':to_java_date(now),'priceUpdatedOn':to_java_date(now),'in_stock':instock}}, multi=True)
Line 525... Line 527...
525
                prepaidBestOne = similarItem
527
                prepaidBestOne = similarItem
526
                prepaidBestPrice = similarItem['available_price']
528
                prepaidBestPrice = similarItem['available_price']
527
                prepaidBestSellerPoints = similarItem['bestSellerPoints']
529
                prepaidBestSellerPoints = similarItem['bestSellerPoints']
528
            else:
530
            else:
529
                pass
531
                pass
530
    print "bestOne ", bestOne
532
    #print "bestOne ", bestOne
531
    print "prepaid best one",  prepaidBestOne
533
    #print "prepaid best one",  prepaidBestOne
532
    if bestOne is not None or prepaidBestOne is not None:
534
    if bestOne is not None or prepaidBestOne is not None:
533
        for similarItem in similarItems:
535
        for similarItem in similarItems:
534
            toUpdate.append(similarItem['_id'])
536
            toUpdate.append(similarItem['_id'])
535
        if bestOne is not None:
537
        if bestOne is not None:
536
            toUpdate.remove(bestOne['_id'])
538
            toUpdate.remove(bestOne['_id'])