diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 2b8332baa63..2a3b4f9a66a 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2428,7 +2428,6 @@ def _list_instructor_tasks(request, course_id, serialize_data=None): # The query_params attribute is utilized for GET requests, # where parameters are passed as query strings. - include_canvas = request.GET.get('include_canvas') is not None course_id = CourseKey.from_string(course_id) if serialize_data is not None: problem_location_str = strip_if_string(serialize_data.get('problem_location_str', False)) @@ -2457,7 +2456,7 @@ def _list_instructor_tasks(request, course_id, serialize_data=None): else: # Specifying for single problem's history tasks = task_api.get_instructor_task_history(course_id, module_state_key) - elif include_canvas: + elif request.GET.get('include_canvas') is not None: from ol_openedx_canvas_integration.task_helpers import get_filtered_instructor_tasks tasks = get_filtered_instructor_tasks(course_id, request.user) else: diff --git a/lms/djangoapps/instructor_task/views.py b/lms/djangoapps/instructor_task/views.py index 3da3657d465..5907b315ec1 100644 --- a/lms/djangoapps/instructor_task/views.py +++ b/lms/djangoapps/instructor_task/views.py @@ -140,7 +140,6 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable= problem_url = None entrance_exam_url = None email_id = None - course_id = None try: task_input = json.loads(instructor_task.task_input) except ValueError: @@ -151,7 +150,6 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable= problem_url = task_input.get('problem_url') entrance_exam_url = task_input.get('entrance_exam_url') email_id = task_input.get('email_id') - course_id = task_input.get('course_key') if instructor_task.task_state == PROGRESS: # special message for providing progress updates: @@ -195,7 +193,7 @@ def get_task_completion_info(instructor_task): # lint-amnesty, pylint: disable= else: # num_succeeded < num_attempted # Translators: {action} is a past-tense verb that is localized separately. {succeeded} and {attempted} are counts. # lint-amnesty, pylint: disable=line-too-long msg_format = _("Problem {action} for {succeeded} of {attempted} students") - elif course_id is not None: + elif task_input and task_input.get('course_key'): from ol_openedx_canvas_integration.utils import get_task_output_formatted_message msg_format = get_task_output_formatted_message(task_output) succeeded = True