Commit c7920f09 by David Ormsbee

Taking Ike's delete-student-state-for-problem code and putting it in a separate…

Taking Ike's delete-student-state-for-problem code and putting it in a separate PR so it's not bundled with more debated features.
parent f8280490
...@@ -195,7 +195,7 @@ def instructor_dashboard(request, course_id): ...@@ -195,7 +195,7 @@ def instructor_dashboard(request, course_id):
track.views.server_track(request, 'dump-answer-dist-csv', {}, page='idashboard') track.views.server_track(request, 'dump-answer-dist-csv', {}, page='idashboard')
return return_csv('answer_dist_{0}.csv'.format(course_id), get_answers_distribution(request, course_id)) return return_csv('answer_dist_{0}.csv'.format(course_id), get_answers_distribution(request, course_id))
elif "Reset student's attempts" in action: elif "Reset student's attempts" in action or "Delete student state for problem" in action:
# get the form data # get the form data
unique_student_identifier = request.POST.get('unique_student_identifier', '') unique_student_identifier = request.POST.get('unique_student_identifier', '')
problem_to_reset = request.POST.get('problem_to_reset', '') problem_to_reset = request.POST.get('problem_to_reset', '')
...@@ -226,6 +226,14 @@ def instructor_dashboard(request, course_id): ...@@ -226,6 +226,14 @@ def instructor_dashboard(request, course_id):
except Exception as e: except Exception as e:
msg += "<font color='red'>Couldn't find module with that urlname. </font>" msg += "<font color='red'>Couldn't find module with that urlname. </font>"
if "Delete student state for problem" in action:
# delete the state
try:
module_to_reset.delete()
msg += "<font color='red'>Deleted student module state for %s!</font>" % module_state_key
except:
msg += "Failed to delete module state for %s/%s" % (unique_student_identifier, problem_to_reset)
else:
# modify the problem's state # modify the problem's state
try: try:
# load the state json # load the state json
......
...@@ -149,6 +149,12 @@ function goto( mode) ...@@ -149,6 +149,12 @@ function goto( mode)
<p><input type="text" name="unique_student_identifier"> <input type="submit" name="action" value="Get link to student's progress page"></p> <p><input type="text" name="unique_student_identifier"> <input type="submit" name="action" value="Get link to student's progress page"></p>
<p>and, if you want to reset the number of attempts for a problem, the urlname of that problem</p> <p>and, if you want to reset the number of attempts for a problem, the urlname of that problem</p>
<p> <input type="text" name="problem_to_reset"> <input type="submit" name="action" value="Reset student's attempts"> </p> <p> <input type="text" name="problem_to_reset"> <input type="submit" name="action" value="Reset student's attempts"> </p>
%if instructor_access:
<p> You may also delete the entire state of a student for a problem:
<input type="submit" name="action" value="Delete student state for problem"> </p>
%endif
%endif %endif
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment