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
--- 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