From d2a131be57f1c39933223766d2f3a8b570e97100 Mon Sep 17 00:00:00 2001 From: Sanford Student Date: Mon, 20 Mar 2017 09:25:59 -0400 Subject: [PATCH] upgrade drag n drop and clean up rescore logic --- lms/djangoapps/instructor_task/api_helper.py | 5 ++++- lms/djangoapps/instructor_task/tasks.py | 6 +----- lms/djangoapps/instructor_task/tasks_helper.py | 9 +++++++++ requirements/edx/github.txt | 4 ++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lms/djangoapps/instructor_task/api_helper.py b/lms/djangoapps/instructor_task/api_helper.py index 4afb41f096..506b636219 100644 --- a/lms/djangoapps/instructor_task/api_helper.py +++ b/lms/djangoapps/instructor_task/api_helper.py @@ -246,7 +246,10 @@ def check_arguments_for_rescoring(usage_key): corresponding module doesn't support rescoring calls. """ descriptor = modulestore().get_item(usage_key) - if not hasattr(descriptor, 'module_class') or not hasattr(descriptor.module_class, 'rescore_problem'): + # TODO: Clean this up as part of TNL-6594 when CAPA uses the ScorableXBlockMixin + if ( + not hasattr(descriptor, 'module_class') or not hasattr(descriptor.module_class, 'rescore_problem') + ) and not hasattr(descriptor, 'rescore'): msg = "Specified module does not support rescoring." raise NotImplementedError(msg) diff --git a/lms/djangoapps/instructor_task/tasks.py b/lms/djangoapps/instructor_task/tasks.py index 7ad7cf2a60..4aa6828c48 100644 --- a/lms/djangoapps/instructor_task/tasks.py +++ b/lms/djangoapps/instructor_task/tasks.py @@ -75,11 +75,7 @@ def rescore_problem(entry_id, xmodule_instance_args): action_name = ugettext_noop('rescored') update_fcn = partial(rescore_problem_module_state, xmodule_instance_args) - def filter_fcn(modules_to_update): - """Filter that matches problems which are marked as being done""" - return modules_to_update.filter(state__contains='"done": true') - - visit_fcn = partial(perform_module_state_update, update_fcn, filter_fcn) + visit_fcn = partial(perform_module_state_update, update_fcn, None) return run_main_task(entry_id, visit_fcn, action_name) diff --git a/lms/djangoapps/instructor_task/tasks_helper.py b/lms/djangoapps/instructor_task/tasks_helper.py index e7d49758f1..8bf8c7bdd6 100644 --- a/lms/djangoapps/instructor_task/tasks_helper.py +++ b/lms/djangoapps/instructor_task/tasks_helper.py @@ -536,6 +536,15 @@ def rescore_problem_module_state(xmodule_instance_args, module_descriptor, stude msg = "Specified problem does not support rescoring." raise UpdateProblemModuleStateError(msg) + # TODO: Remove the first part of this if-else with TNL-6594 + # We check here to see if the problem has any submissions. If it does not, we don't want to rescore it + if hasattr(instance, "done"): + if not instance.done: + return UPDATE_STATUS_SKIPPED + else: + if instance.has_submitted_answer(): + return UPDATE_STATUS_SKIPPED + # Set the tracking info before this call, because it makes downstream # calls that create events. We retrieve and store the id here because # the request cache will be erased during downstream calls. diff --git a/requirements/edx/github.txt b/requirements/edx/github.txt index c2293e5688..d569b5241f 100644 --- a/requirements/edx/github.txt +++ b/requirements/edx/github.txt @@ -84,7 +84,7 @@ git+https://github.com/solashirai/crowdsourcehinter.git@518605f0a95190949fe77bd3 -e git+https://github.com/pmitros/RateXBlock.git@367e19c0f6eac8a5f002fd0f1559555f8e74bfff#egg=rate-xblock -e git+https://github.com/pmitros/DoneXBlock.git@release-2016-08-10#egg=done-xblock git+https://github.com/edx/edx-milestones.git@v0.1.10#egg=edx-milestones==0.1.10 -git+https://github.com/edx/xblock-utils.git@v1.0.3#egg=xblock-utils==1.0.3 +git+https://github.com/edx/xblock-utils.git@v1.0.4#egg=xblock-utils==1.0.4 -e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive -e git+https://github.com/edx/edx-reverification-block.git@0.0.5#egg=edx-reverification-block==0.0.5 git+https://github.com/edx/edx-user-state-client.git@1.0.1#egg=edx-user-state-client==1.0.1 @@ -93,4 +93,4 @@ git+https://github.com/edx/edx-proctoring.git@0.18.0#egg=edx-proctoring==0.18.0 # Third Party XBlocks git+https://github.com/open-craft/xblock-poll@v1.2.6#egg=xblock-poll==1.2.6 -git+https://github.com/edx-solutions/xblock-drag-and-drop-v2@v2.0.15#egg=xblock-drag-and-drop-v2==2.0.15 +git+https://github.com/edx-solutions/xblock-drag-and-drop-v2@v2.0.17#egg=xblock-drag-and-drop-v2==2.0.17