# HG changeset patch
# User Sverre Rabbelier <srabbelier@gmail.com>
# Date 1239362853 0
# Node ID 67c1cb524b78cf320085b4596698b329288f93d1
# Parent  573301607587f66d5c8c8400c5a98219ac3b8d85
Fix bug exposed in previous commit

Patch by: Sverre Rabbelier

diff -r 573301607587 -r 67c1cb524b78 app/soc/logic/allocations.py
--- a/app/soc/logic/allocations.py	Fri Apr 10 11:27:15 2009 +0000
+++ b/app/soc/logic/allocations.py	Fri Apr 10 11:27:33 2009 +0000
@@ -277,6 +277,10 @@
 
     total_popularity = sum(self.popularity.values())
 
+    # all orgs have been locked, nothing to do
+    if total_popularity <= 0:
+      return allocations
+
     pop_per_slot = float(available_slots)/float(total_popularity)
 
     slack = 0