From 0dd0f1f81d625fd747df49057272a3a41e5efc06 Mon Sep 17 00:00:00 2001 From: Matjaz Gregoric Date: Tue, 9 Aug 2016 16:28:07 +0800 Subject: [PATCH 1/2] Hide 'Reset Attempts' and 'Rescore Problem' on unsupported blocks. CAPA problems have the "Staff Debug Info" button, which allows instructors to "Reset Attempts" and "Rescore problem" for any individual student. XBlocks, such as Drag and Drop v2 do not support those, though the UI was still present. Clicking any of those links would result in an "Unknown Error Occurred" message. This commit hides the two buttons if the associated block does not support them. --- lms/templates/staff_problem_info.html | 6 +++++- openedx/core/lib/xblock_utils.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html index 24ca39783b..36db395c3d 100644 --- a/lms/templates/staff_problem_info.html +++ b/lms/templates/staff_problem_info.html @@ -68,13 +68,17 @@ ${block_content}
[ + % if can_reset_attempts: ${_('Reset Student Attempts')} - % if has_instructor_access: | + % endif + % if has_instructor_access: ${_('Delete Student State')} + % if can_rescore_problem: | ${_('Rescore Student Submission')} % endif + % endif ]
diff --git a/openedx/core/lib/xblock_utils.py b/openedx/core/lib/xblock_utils.py index 757230053c..4474b832b3 100644 --- a/openedx/core/lib/xblock_utils.py +++ b/openedx/core/lib/xblock_utils.py @@ -382,6 +382,8 @@ def add_staff_markup(user, has_instructor_access, disable_staff_debug_info, bloc 'block_content': frag.content, 'is_released': is_released, 'has_instructor_access': has_instructor_access, + 'can_reset_attempts': 'attempts' in block.fields, + 'can_rescore_problem': hasattr(block, 'rescore_problem'), 'disable_staff_debug_info': disable_staff_debug_info, } return wrap_fragment(frag, render_to_string("staff_problem_info.html", staff_context)) From 32fb5517c01da29fa63b8a70d935ce74bb88ffe5 Mon Sep 17 00:00:00 2001 From: Matjaz Gregoric Date: Wed, 10 Aug 2016 23:55:26 +0800 Subject: [PATCH 2/2] Fix staff debug module field table width. The auto-adjusting table layout would get illegible for certain types of problems that contain a large amount of data because the first column could get very narrow (down to the width of a single character). This commit fixes the width of the first column to 25%. --- lms/templates/staff_problem_info.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html index 36db395c3d..4d5cbfea6c 100644 --- a/lms/templates/staff_problem_info.html +++ b/lms/templates/staff_problem_info.html @@ -87,16 +87,17 @@ ${block_content}
is_released = ${is_released} location = ${location.to_deprecated_string() | h} + %for name, field in fields: - + %endfor
${_('Module Fields')}
${name}
${field | h}
${name}
${field | h}
%for name, field in xml_attributes.items(): - + %endfor
${_('XML attributes')}
${name}
${field | h}
${name}
${field | h}
category = ${category | h}