Commit 6fcf65ef by Calen Pennington

Fix staff debug view

parent 484c529d
......@@ -832,7 +832,7 @@ def rescore_problem(request, course_id):
try:
module_state_key = UsageKey.from_string(problem_to_reset)
except InvalidKeyError:
return HttpResponseBadRequest()
return HttpResponseBadRequest("Unable to parse problem id")
response_payload = {}
response_payload['problem_to_reset'] = problem_to_reset
......
......@@ -22,7 +22,7 @@ var StaffDebug = (function(){
do_idash_action = function(action){
var pdata = {
'problem_to_reset': action.location,
'unique_student_identifier': get_user(action.location),
'unique_student_identifier': get_user(action.locationName),
'delete_module': action.delete_module
}
$.ajax({
......@@ -40,7 +40,7 @@ var StaffDebug = (function(){
{text: text},
{interpolate: /\{(.+?)\}/g}
)
$("#result_"+action.location).html(html);
$("#result_"+action.locationName).html(html);
},
error: function(request, status, error) {
var response_json;
......@@ -62,15 +62,16 @@ var StaffDebug = (function(){
{text: text},
{interpolate: /\{(.+?)\}/g}
)
$("#result_"+action.location).html(html);
$("#result_"+action.locationName).html(html);
},
dataType: 'json'
});
}
reset = function(locname){
reset = function(locname, location){
this.do_idash_action({
location: locname,
locationName: locname,
location: location,
method: 'reset_student_attempts',
success_msg: gettext('Successfully reset the attempts for user {user}'),
error_msg: gettext('Failed to reset attempts.'),
......@@ -78,9 +79,10 @@ var StaffDebug = (function(){
});
}
sdelete = function(locname){
sdelete = function(locname, location){
this.do_idash_action({
location: locname,
locationName: locname,
location: location,
method: 'reset_student_attempts',
success_msg: gettext('Successfully deleted student state for user {user}'),
error_msg: gettext('Failed to delete student state.'),
......@@ -88,9 +90,10 @@ var StaffDebug = (function(){
});
}
rescore = function(locname){
rescore = function(locname, location){
this.do_idash_action({
location: locname,
locationName: locname,
location: location,
method: 'rescore_problem',
success_msg: gettext('Successfully rescored problem for user {user}'),
error_msg: gettext('Failed to rescore problem.'),
......@@ -112,15 +115,15 @@ var StaffDebug = (function(){
// Register click handlers
$(document).ready(function() {
$('#staff-debug-reset').click(function() {
StaffDebug.reset($(this).data('location'));
StaffDebug.reset($(this).parent().data('location-name'), $(this).parent().data('location'));
return false;
});
$('#staff-debug-sdelete').click(function() {
StaffDebug.sdelete($(this).data('location'));
StaffDebug.sdelete($(this).parent().data('location-name'), $(this).parent().data('location'));
return false;
});
$('#staff-debug-rescore').click(function() {
StaffDebug.rescore($(this).data('location'));
StaffDebug.rescore($(this).parent().data('location-name'), $(this).parent().data('location'));
return false;
});
});
......@@ -61,14 +61,14 @@ ${block_content}
<label for="sd_fu_${location.name}">${_('Username')}:</label>
<input type="text" id="sd_fu_${location.name}" placeholder="${user.username}"/>
</div>
<div>
<div data-location="${unicode(location)}" data-location-name="${location.name}">
[
<a href="#" id="staff-debug-reset" data-location="${location.name}">${_('Reset Student Attempts')}</a>
<a href="#" id="staff-debug-reset">${_('Reset Student Attempts')}</a>
|
<a href="#" id="staff-debug-sdelete" data-location="${location.name}">${_('Delete Student State')}</a>
<a href="#" id="staff-debug-sdelete">${_('Delete Student State')}</a>
|
<a href="#" id="staff-debug-rescore" data-location="${location.name}">${_('Rescore Student Submission')}</a>
<a href="#" id="staff-debug-rescore">${_('Rescore Student Submission')}</a>
]
</div>
<div id="result_${location.name}"/>
......@@ -128,7 +128,7 @@ $(function () {
null,
%endif
{
'location': '${location}',
'location': '${location.to_deprecated_string()}',
'xqa_key': '${xqa_key}',
'category': '${category}',
'user': '${user}'
......
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