Skip to content

Commit

Permalink
more refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanashraf7 committed Nov 6, 2024
1 parent 449572b commit 8e40853
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lms/djangoapps/instructor/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions lms/djangoapps/instructor_task/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8e40853

Please sign in to comment.