Merge pull request #10533 from edx/cdodge/adjust-report-task-routing

change 'routing' for some reports which go to potentially backlogged …
This commit is contained in:
chrisndodge
2015-11-06 09:45:20 -05:00
2 changed files with 11 additions and 9 deletions

View File

@@ -204,7 +204,7 @@ def calculate_students_features_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
@task(base=BaseInstructorTask) # pylint: disable=not-callable
def enrollment_report_features_csv(entry_id, xmodule_instance_args):
"""
Compute student profile information for a course and upload the
@@ -216,7 +216,7 @@ def enrollment_report_features_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
@task(base=BaseInstructorTask) # pylint: disable=not-callable
def exec_summary_report_csv(entry_id, xmodule_instance_args):
"""
Compute executive summary report for a course and upload the
@@ -228,7 +228,7 @@ def exec_summary_report_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
@task(base=BaseInstructorTask) # pylint: disable=not-callable
def course_survey_report_csv(entry_id, xmodule_instance_args):
"""
Compute the survey report for a course and upload the
@@ -240,7 +240,7 @@ def course_survey_report_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
@task(base=BaseInstructorTask) # pylint: disable=not-callable
def proctored_exam_results_csv(entry_id, xmodule_instance_args):
"""
Compute proctored exam results report for a course and upload the

View File

@@ -1327,12 +1327,15 @@ def upload_course_survey_report(_xmodule_instance_args, _entry_id, course_id, _t
survey_fields.sort()
user_survey_answers = OrderedDict()
survey_answers_for_course = SurveyAnswer.objects.filter(course_key=course_id)
survey_answers_for_course = SurveyAnswer.objects.filter(course_key=course_id).select_related('user')
for survey_field_record in survey_answers_for_course:
user_id = survey_field_record.user.id
if user_id not in user_survey_answers.keys():
user_survey_answers[user_id] = {}
user_survey_answers[user_id] = {
'username': survey_field_record.user.username,
'email': survey_field_record.user.email
}
user_survey_answers[user_id][survey_field_record.field_name] = survey_field_record.field_value
@@ -1343,9 +1346,8 @@ def upload_course_survey_report(_xmodule_instance_args, _entry_id, course_id, _t
for user_id in user_survey_answers.keys():
row = []
row.append(user_id)
user_obj = User.objects.get(id=user_id)
row.append(user_obj.username)
row.append(user_obj.email)
row.append(user_survey_answers[user_id].get('username', ''))
row.append(user_survey_answers[user_id].get('email', ''))
for survey_field in survey_fields:
row.append(user_survey_answers[user_id].get(survey_field, ''))
csv_rows.append(row)