Subversion Repositories SmartDukaan

Rev

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

Rev 17067 Rev 17068
Line 56... Line 56...
56
    for x in bestSellers:
56
    for x in bestSellers:
57
        print x.rank,
57
        print x.rank,
58
        print '\t',
58
        print '\t',
59
        print x.identifier,
59
        print x.identifier,
60
        print '\t',
60
        print '\t',
61
        col = list(get_mongo_connection().Catalog.MasterData.find({'identifier':x.identifier, 'source_id':7}))
61
        col = list(get_mongo_connection(host=options.mongoHost).Catalog.MasterData.find({'identifier':x.identifier, 'source_id':7}))
62
        print "count sku",len(col)
62
        print "count sku",len(col)
63
        print '\n'
63
        print '\n'
64
        if len(col) == 0:
64
        if len(col) == 0:
65
            x.category = category
65
            x.category = category
66
            exceptionList.append(x)
66
            exceptionList.append(x)
67
        else:
67
        else:
68
            get_mongo_connection().Catalog.MasterData.update({'identifier':x.identifier, 'source_id':7 }, {'$set' : {'rank':x.rank,'updatedOn':to_java_date(now)}})
68
            get_mongo_connection(host=options.mongoHost).Catalog.MasterData.update({'identifier':x.identifier, 'source_id':7 }, {'$set' : {'rank':x.rank,'updatedOn':to_java_date(now)}})
69
 
69
 
70
    
70
    
71
def scrapeBestSellerMobiles():
71
def scrapeBestSellerMobiles():
72
    global bestSellers
72
    global bestSellers
73
    rank = 0
73
    rank = 0
Line 124... Line 124...
124
            print productUrl, source_product_name, thumbnail, rank, available_price, identfier, inStock
124
            print productUrl, source_product_name, thumbnail, rank, available_price, identfier, inStock
125
            r_info = __RankInfo(identfier, rank, None , available_price, inStock, thumbnail, source_product_name, productUrl)
125
            r_info = __RankInfo(identfier, rank, None , available_price, inStock, thumbnail, source_product_name, productUrl)
126
            bestSellers.append(r_info)
126
            bestSellers.append(r_info)
127
                
127
                
128
def resetRanks(category_id):
128
def resetRanks(category_id):
129
    get_mongo_connection().Catalog.MasterData.update({'rank':{'$gt':0},'source_id':7,'category_id':category_id}, {'$set':{'rank':0}}, upsert=False, multi=True)
129
    get_mongo_connection(host=options.mongoHost).Catalog.MasterData.update({'rank':{'$gt':0},'source_id':7,'category_id':category_id}, {'$set':{'rank':0}}, upsert=False, multi=True)
130
 
130
 
131
def sendEmail():
131
def sendEmail():
132
    message="""<html>
132
    message="""<html>
133
            <body>
133
            <body>
134
            <h3>HomeShop18 Best Sellers not in master</h3>
134
            <h3>HomeShop18 Best Sellers not in master</h3>