Add "Download CSV of all student anonymized IDs" button to instructor dashboard
This is a recurrent ops problem, so we wanted to make it available on the instructor dashboard.
This commit is contained in:
@@ -50,7 +50,7 @@ from instructor_task.api import (get_running_instructor_tasks,
|
||||
from instructor_task.views import get_task_completion_info
|
||||
from mitxmako.shortcuts import render_to_response
|
||||
from psychometrics import psychoanalyze
|
||||
from student.models import CourseEnrollment, CourseEnrollmentAllowed
|
||||
from student.models import CourseEnrollment, CourseEnrollmentAllowed, unique_id_for_user
|
||||
from student.views import course_from_id
|
||||
import track.views
|
||||
from mitxmako.shortcuts import render_to_string
|
||||
@@ -584,6 +584,15 @@ def instructor_dashboard(request, course_id):
|
||||
datatable['title'] = 'Student state for problem %s' % problem_to_dump
|
||||
return return_csv('student_state_from_%s.csv' % problem_to_dump, datatable)
|
||||
|
||||
elif 'Download CSV of all student anonymized IDs' in action:
|
||||
students = User.objects.filter(
|
||||
courseenrollment__course_id=course_id,
|
||||
).order_by('id')
|
||||
|
||||
datatable = {'header': ['User ID', 'Anonymized user ID']}
|
||||
datatable['data'] = [[s.id, unique_id_for_user(s)] for s in students]
|
||||
return return_csv(course_id.replace('/', '-')+'-anon-ids.csv', datatable)
|
||||
|
||||
#----------------------------------------
|
||||
# Group management
|
||||
|
||||
|
||||
@@ -416,6 +416,9 @@ function goto( mode)
|
||||
<input type="text" name="problem_to_dump" size="40">
|
||||
<input type="submit" name="action" value="Download CSV of all responses to problem">
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" name="action" value="Download CSV of all student anonymized IDs">
|
||||
</p>
|
||||
<hr width="40%" style="align:left">
|
||||
%endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user