Use the new nr_applications and nr_mentors
authorSverre Rabbelier <srabbelier@gmail.com>
Mon, 06 Apr 2009 22:55:27 +0000
changeset 2106 2131c4b05ca3
parent 2105 eb92d9a6b027
child 2107 855daf131060
Use the new nr_applications and nr_mentors This saves _a lot_ of computing time, making it possible to use the slot allocation view when there are a significant number of orgs. Patch by: Sverre Rabbelier
app/soc/views/models/program.py
--- a/app/soc/views/models/program.py	Mon Apr 06 22:55:08 2009 +0000
+++ b/app/soc/views/models/program.py	Mon Apr 06 22:55:27 2009 +0000
@@ -292,15 +292,9 @@
     mentors = {}
 
     for org in organizations:
-      filter = {
-          'org': org,
-          'status': ['new', 'pending']
-          }
       orgs[org.link_id] = org
-      query = student_proposal_logic.logic.getQueryForFields(filter=filter)
-      proposals = student_proposal_logic.logic.getAll(query)
-      applications[org.link_id] = len(proposals)
-      mentors[org.link_id] = len([i for i in proposals if i.mentor != None])
+      applications[org.link_id] = org.nr_applications
+      mentors[org.link_id] = org.nr_mentors
 
     # TODO: Use configuration variables here
     max_slots_per_org = 40