Added GradingSurveyGroup update to the Module Conversion.
authorLennard de Rijk <ljvderijk@gmail.com>
Sun, 18 Oct 2009 16:52:38 +0200
changeset 3021 baeb847b88e6
parent 3020 b2c97cbba7df
child 3022 8ade9aac79f9
Added GradingSurveyGroup update to the Module Conversion.
app/soc/tasks/updates/module_conversion.py
--- a/app/soc/tasks/updates/module_conversion.py	Sun Oct 18 16:33:05 2009 +0200
+++ b/app/soc/tasks/updates/module_conversion.py	Sun Oct 18 16:52:38 2009 +0200
@@ -30,6 +30,8 @@
 from soc.logic.models import survey as survey_logic
 from soc.logic.models import survey_record as survey_record_logic
 from soc.logic.models.document import logic as document_logic
+from soc.logic.models.grading_survey_group import logic as \
+    grading_survey_group_logic
 from soc.logic.models.mentor import logic as mentor_logic
 from soc.logic.models.org_admin import logic as org_admin_logic
 from soc.logic.models.organization import logic as org_logic
@@ -476,6 +478,28 @@
   return
 
 
+@decorators.iterative_task(grading_survey_group_logic)
+def runGradingSurveyGroupUpdate(request, entities, context, *args, **kwargs):
+  """AppEngine Task that updates GradingSurveyGroup entities.
+
+  Args:
+    request: Django Request object
+    entities: list of Document entities to update
+    context: the context of this task
+  """
+
+  from soc.modules.gsoc.logic.models.program import logic as program_logic
+
+  for entity in entities:
+    entity.scope = program_logic.getFromKeyName(
+        entity.scope.key().id_or_name())
+
+  db.put(entities)
+
+  # task completed, return
+  return
+
+
 @decorators.iterative_task(document_logic)
 def runDocumentUpdate(request, entities, context, *args, **kwargs):
   """AppEngine Task that updates Document entities.