예제 #1
0
 def do_process_matrix(self):
     debug('Allocate inventory for buy orders...')
     self.do_allocate_inventory_for_buy_orders()
     debug('Canceling dead plans...')
     MemberRentalPlan.cancel_dead_plans()
     debug('Canceling expired plans...')
     MemberRentalPlan.cancel_expired_plans()
     debug('Calculating weights...')
     self.do_weight_matrix()
     debug('OK')
     debug('Processing matrix...')
     for o in RentList.get_priority1():
         debug('--------------------------')
         debug('Allocation matrix for %s - %s %s (%s) %s', o.id, o.item, o.item.category, o.user, o.weight)
         RentAllocationMatrix.process_item(o)
     debug('OK')
예제 #2
0
 def do_weight_matrix(self):
     for o in RentList.get_priority1():
         w = RentAllocationMatrix.calculate_weight(o)
         debug('Allocation weight for %s - %s %s (%s): %s (old: %s)', o.id, o.item, o.item.category, o.user, w, o.weight)
         if w != o.weight:
             o.weight = w
             o.save()