Subversion Repositories SmartDukaan

Rev

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

Rev 18540 Rev 18549
Line 112... Line 112...
112
                item['maxQuantity'] = temp_maxQuantity
112
                item['maxQuantity'] = temp_maxQuantity
113
            else:
113
            else:
114
                item['maxQuantity'] = min(availability,item.get('maxQuantity'))
114
                item['maxQuantity'] = min(availability,item.get('maxQuantity'))
115
            if item['minBuyQuantity'] > availability:
115
            if item['minBuyQuantity'] > availability:
116
                item['minBuyQuantity'] = availability
116
                item['minBuyQuantity'] = availability
117
            if k==1007389:
-
 
118
                print item['bulkPricing']
-
 
119
            toremove = []
117
            toremove = []
120
            for bulkPricing in item['bulkPricing']:
118
            for bulkPricing in item['bulkPricing']:
121
                if k==1007389:
-
 
122
                    print bulkPricing
-
 
123
                if bulkPricing['quantity'] < item['minBuyQuantity'] or bulkPricing['quantity'] > item['maxQuantity']:
119
                if bulkPricing['quantity'] < item['minBuyQuantity'] or bulkPricing['quantity'] > item['maxQuantity']:
124
                    if k==1007389:
-
 
125
                        print "Removing ",bulkPricing
-
 
126
                        toremove.append(bulkPricing)
120
                    toremove.append(bulkPricing)
127
            for removePricing in toremove:
121
            for removePricing in toremove:
128
                item['bulkPricing'].remove(removePricing)
122
                item['bulkPricing'].remove(removePricing)
129
            if k==1007389:
-
 
130
                print "Final bulk pricing ",item['bulkPricing']
-
 
131
            item['bulkPricing'] = sorted(item['bulkPricing'], key=lambda k: k['quantity'],reverse=False)
123
            item['bulkPricing'] = sorted(item['bulkPricing'], key=lambda k: k['quantity'],reverse=False)
132
        temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
124
        temp = sorted(v, key = lambda x: (x['availability']),reverse=True)
133
        mc = get_memcache_connection(host=options.mongoHost)
125
        mc = get_memcache_connection(host=options.mongoHost)
134
        mc.set(str("item_availability_"+str(k)), temp, 60*60)
126
        mc.set(str("item_availability_"+str(k)), temp, 60*60)
135
 
127