equal
deleted
inserted
replaced
62 ranker_root = ranker_root_logic.getForFields(fields, unique=True) |
62 ranker_root = ranker_root_logic.getForFields(fields, unique=True) |
63 ranker = ranker_root_logic.getRootFromEntity(ranker_root) |
63 ranker = ranker_root_logic.getRootFromEntity(ranker_root) |
64 |
64 |
65 return ranker |
65 return ranker |
66 |
66 |
67 def getProposalsToBeAcceptedForOrg(self, org_entity, stepsize=25): |
67 def getProposalsToBeAcceptedForOrg(self, org_entity, step_size=25): |
68 """Returns all StudentProposals which will be accepted into the program |
68 """Returns all StudentProposals which will be accepted into the program |
69 for the given organization. |
69 for the given organization. |
70 |
70 |
71 params: |
71 params: |
72 org_entity: the Organization for which the proposals should be checked |
72 org_entity: the Organization for which the proposals should be checked |
73 stepsize: optional parameter to specify the ammount of Student Proposals |
73 step_size: optional parameter to specify the amount of Student Proposals |
74 that should be retrieved per roundtrip to the datastore |
74 that should be retrieved per roundtrip to the datastore |
75 |
75 |
76 returns: |
76 returns: |
77 List with all StudentProposal which will be accepted into the program |
77 List with all StudentProposal which will be accepted into the program |
78 """ |
78 """ |
103 offset = slots_left_to_assign |
103 offset = slots_left_to_assign |
104 |
104 |
105 # retrieve as many additional proposals as needed in case the top |
105 # retrieve as many additional proposals as needed in case the top |
106 # N do not have a mentor assigned |
106 # N do not have a mentor assigned |
107 while len(proposals) < slots_left_to_assign: |
107 while len(proposals) < slots_left_to_assign: |
108 new_proposals = query.fetch(stepsize, offset=offset) |
108 new_proposals = query.fetch(step_size, offset=offset) |
109 |
109 |
110 if not new_proposals: |
110 if not new_proposals: |
111 # we ran out of proposals` |
111 # we ran out of proposals` |
112 break |
112 break |
113 |
113 |
114 new_proposals = [i for i in new_proposals if i.mentor] |
114 new_proposals = [i for i in new_proposals if i.mentor] |
115 proposals += new_proposals |
115 proposals += new_proposals |
116 offset += stepsize |
116 offset += step_size |
117 |
117 |
118 # cut off any superfluous proposals |
118 # cut off any superfluous proposals |
119 return proposals[:slots_left_to_assign] |
119 return proposals[:slots_left_to_assign] |
120 |
120 |
121 def _onCreate(self, entity): |
121 def _onCreate(self, entity): |