# HG changeset patch # User Sverre Rabbelier # Date 1254692246 -7200 # Node ID 99f2d9b1ff7d528c49e035c3a136dca59c50cbd5 # Parent 525c65b0a320c4fad5d6d166bbe9c33d9f54441e Added update for SurveyRecords Both ProjectSurveyRecords and GradingProjectSurveyRecords are converted to updated with their new GSoC references. diff -r 525c65b0a320 -r 99f2d9b1ff7d app/soc/tasks/updates/module_conversion.py --- a/app/soc/tasks/updates/module_conversion.py Sun Oct 04 21:25:52 2009 +0200 +++ b/app/soc/tasks/updates/module_conversion.py Sun Oct 04 23:37:26 2009 +0200 @@ -28,6 +28,7 @@ from django.http import HttpResponse from soc.logic.models import survey as survey_logic +from soc.logic.models import survey_record as survey_record_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 @@ -384,3 +385,47 @@ # task completed, return return + + +@decorators.iterative_task(survey_record.project_logic) +def runProjectSurveyRecordUpdate(request, entities, context, *args, **kwargs): + """AppEngine Task that updates ProjectSurveyRecord entities. + + Args: + request: Django Request object + entities: list of ProjectSurveyRecord entities to update + context: the context of this task + """ + + return _runSurveyRecordUpdate(entities) + + +@decorators.iterative_task(survey_record.grading_logic) +def runGradingProjectSurveyRecordsUpdate(request, entities, context, *args, **kwargs): + """AppEngine Task that updates GradingProjectSurveyRecord entities. + + Args: + request: Django Request object + entities: list of GradingProjectSurveyRecord entities to update + context: the context of this task + """ + + return _runSurveyRecordUpdate(entities) + + +def _runSurveyRecordUpdate(entities): + """AppEngine Task taht updates SurveyRecord entities. + + Args: + entities: list of SurveyRecord entities to update + """ + + from soc.modules.gsoc.logic.models.organization import logic as org_logic + + for entity in entities: + entity.org = org_logic.getFromKeyName(entity.org.key().id_or_name()) + + db.put(entities) + + # task completed, return + return