diff --git a/lms/djangoapps/instructor_task/tasks_helper.py b/lms/djangoapps/instructor_task/tasks_helper.py index c94fb124b4..1522ed821d 100644 --- a/lms/djangoapps/instructor_task/tasks_helper.py +++ b/lms/djangoapps/instructor_task/tasks_helper.py @@ -541,8 +541,7 @@ def rescore_problem_module_state(xmodule_instance_args, module_descriptor, stude if hasattr(instance, "done"): if not instance.done: return UPDATE_STATUS_SKIPPED - else: - if instance.has_submitted_answer(): + elif not instance.has_submitted_answer(): return UPDATE_STATUS_SKIPPED # Set the tracking info before this call, because it makes downstream diff --git a/lms/djangoapps/instructor_task/tests/test_tasks.py b/lms/djangoapps/instructor_task/tests/test_tasks.py index ebe14cdbff..e31ddcac2d 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks.py @@ -322,9 +322,14 @@ class TestRescoreInstructorTask(TestInstructorTasks): getattr(mock_instance, rescore_method).return_value = rescore_result delattr(mock_instance, other_method) - input_state = json.dumps({'done': True}) + if rescore_method == 'rescore': + del mock_instance.done + mock_instance.has_submitted_answer.return_value = True + else: + mock_instance.done = True + num_students = 10 - self._create_students_with_state(num_students, input_state) + self._create_students_with_state(num_students) task_entry = self._create_input_entry() with patch('lms.djangoapps.instructor_task.tasks_helper.get_module_for_descriptor_internal') as mock_get_module: mock_get_module.return_value = mock_instance