scripts/stats.py
changeset 2222 a91d55e9c9cd
parent 2218 84b0ce492cf5
child 2234 69539a5ca63a
--- a/scripts/stats.py	Sat Apr 18 18:59:53 2009 +0000
+++ b/scripts/stats.py	Sat Apr 18 19:00:04 2009 +0000
@@ -222,7 +222,7 @@
     fields = {
         'link_id': 't%i' % (int(time.time()*100)),
         'scope_path': proposal.org.key().id_or_name(),
-        'scope': proposal.organization,
+        'scope': proposal.org,
         'program': proposal.program,
         'student': proposal.scope,
         'title': proposal.title,
@@ -230,27 +230,30 @@
         'mentor': proposal.mentor,
         }
 
-    project = project_logic.updateOrCreateFromFields(fields)
+    project = project_logic.updateOrCreateFromFields(fields, silent=True)
 
     fields = {
         'status':'accepted',
         }
-    proposal_logic.updateEntityProperties(proposal, fields)
+
+    proposal_logic.updateEntityProperties(proposal, fields, silent=True)
 
   fields = {
-      'status': ['new', 'pending', 'invalid'],
+      'status': ['new', 'pending'],
       'org': org,
       }
 
-  query = proposal_logic.getQueryForFields(filter)
-  proposals = interactive.deepFetch(query)
+  querygen = lambda: proposal_logic.getQueryForFields(fields)
+  proposals = [i for i in interactive.deepFetch(querygen)]
+
+  print "rejecting %d proposals" % len(proposals)
 
   fields = {
       'status': 'rejected',
       }
 
   for proposal in proposals:
-    proposal_logic.updateEntityProperties(proposal, fields)
+    proposal_logic.updateEntityProperties(proposal, fields, silent=True)
 
 
 def loadPickle(name):
@@ -301,6 +304,7 @@
       'getOrgAdmins': getEntities(OrgAdmin),
       'getProps': getProps,
       'countStudentsWithProposals': countStudentsWithProposals,
+      'convertProposals': convertProposals,
       'addFollower': addFollower,
       'Organization': Organization,
       'User': User,