app/soc/logic/allocations.py
changeset 1748 f789ffe213a3
parent 1737 9dc63101b107
child 1751 17c7a7a48dc7
equal deleted inserted replaced
1747:02f15a955c42 1748:f789ffe213a3
   179       org_applications_count = len(org_applications)
   179       org_applications_count = len(org_applications)
   180       mentors = self.mentors[org]
   180       mentors = self.mentors[org]
   181 
   181 
   182       if org in locked_orgs:
   182       if org in locked_orgs:
   183         slots = locked_slots[org]
   183         slots = locked_slots[org]
   184       else:
   184       elif unallocated_applications_count:
   185         weight = float(org_applications_count) / unallocated_applications_count
   185         weight = float(org_applications_count) / float(unallocated_applications_count)
   186         slots = int(math.floor(weight*available_slots))
   186         slots = int(math.floor(weight*available_slots))
   187 
   187 
   188       if org in adjusted_orgs:
   188       if org in adjusted_orgs:
   189         slots += adjusted_slots[org]
   189         slots += adjusted_slots[org]
   190 
   190 
   224       available_slots -= slots
   224       available_slots -= slots
   225       allocations[org] = slots
   225       allocations[org] = slots
   226 
   226 
   227     # adjust the orgs in need of adjusting
   227     # adjust the orgs in need of adjusting
   228     for org in adjusted_orgs:
   228     for org in adjusted_orgs:
   229       slots = adjusted_slots[org]
   229       slots = float(adjusted_slots[org])
   230 
   230 
   231       adjustment = (float(total_popularity)/float(available_slots))*slots
   231       adjustment = (float(total_popularity)/float(available_slots))*slots
   232       adjustment = int(math.ceil(adjustment))
   232       adjustment = int(math.ceil(adjustment))
   233       self.popularity[org] += adjustment
   233       self.popularity[org] += adjustment
   234 
   234