Subversion Repositories SmartDukaan

Rev

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

Rev 16534 Rev 16635
Line 6... Line 6...
6
from dtr.utils.utils import to_java_date
6
from dtr.utils.utils import to_java_date
7
from datetime import datetime, timedelta
7
from datetime import datetime, timedelta
8
import time
8
import time
9
import optparse
9
import optparse
10
from dtr.storage.MemCache import MemCache
10
from dtr.storage.MemCache import MemCache
-
 
11
import traceback
11
 
12
 
12
parser = optparse.OptionParser()
13
parser = optparse.OptionParser()
13
parser.add_option("-H", "--host", dest="hostname",
14
parser.add_option("-H", "--host", dest="hostname",
14
                      default="localhost",
15
                      default="localhost",
15
                      type="string", help="The HOST where the DB server is running",
16
                      type="string", help="The HOST where the DB server is running",
Line 277... Line 278...
277
        deal_item = list(get_mongo_connection().Catalog.Deals.find({'skuBundleId':sku['skuBundleId']}).sort('bestSellerPoints',pymongo.DESCENDING).limit(1))
278
        deal_item = list(get_mongo_connection().Catalog.Deals.find({'skuBundleId':sku['skuBundleId']}).sort('bestSellerPoints',pymongo.DESCENDING).limit(1))
278
        sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints']
279
        sku['catalogBestSellerPoints'] = deal_item[0]['bestSellerPoints']
279
        shortagePoints = 50 if sku['_id'] in shortageSkus else 0
280
        shortagePoints = 50 if sku['_id'] in shortageSkus else 0
280
        print "Shortage points for ",sku['_id']
281
        print "Shortage points for ",sku['_id']
281
        print shortagePoints
282
        print shortagePoints
-
 
283
        try:
282
        sku['totalPoints'] = sku['catalogBestSellerPoints'] + sku['nlcPoints'] + shortagePoints + sku['dealPoints'] 
284
            sku['totalPoints'] = sku['catalogBestSellerPoints'] + sku['nlcPoints'] + shortagePoints + sku['dealPoints'] 
283
        get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'catalogBestSellerPoints':sku['catalogBestSellerPoints'],'totalPoints':sku['totalPoints']}},multi=False)
285
            get_mongo_connection().Catalog.Deals.update({'_id':sku['_id']},{'$set':{'catalogBestSellerPoints':sku['catalogBestSellerPoints'],'totalPoints':sku['totalPoints']}},multi=False)
-
 
286
        except:
-
 
287
            print traceback.print_exc()
284
    
288
    
285
    
289
    
286
 
290
 
287
def populateNegativeDeals():
291
def populateNegativeDeals():
288
    negativeDeals = get_mongo_connection().Catalog.NegativeDeals.find().distinct('sku')
292
    negativeDeals = get_mongo_connection().Catalog.NegativeDeals.find().distinct('sku')