upgrade drag n drop and clean up rescore logic

This commit is contained in:
Sanford Student
2017-03-20 09:25:59 -04:00
parent 4c8dc9044d
commit d2a131be57
4 changed files with 16 additions and 8 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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.