Skip to content

Commit

Permalink
refactor more code
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanashraf7 committed Oct 30, 2024
1 parent 1c34f29 commit 3a4d591
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
9 changes: 5 additions & 4 deletions lms/djangoapps/instructor/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,7 @@ def _list_instructor_tasks(request, course_id, serialize_data=None):
Internal function with common code for both DRF and and tradition views.
"""
# This method is also used by other APIs with the GET method.
# The query_params attribute is utilized for GET requests,
# where parameters are passed as query strings.

Expand Down Expand Up @@ -2457,10 +2458,10 @@ def _list_instructor_tasks(request, course_id, serialize_data=None):
# Specifying for single problem's history
tasks = task_api.get_instructor_task_history(course_id, module_state_key)
elif include_canvas:
tasks = task_api.get_running_instructor_canvas_tasks(
course_id,
user=request.user
)
from ol_openedx_canvas_integration.constants import CANVAS_TASK_TYPES # pylint: disable=import-error
from ol_openedx_canvas_integration.task_helpers import _get_filtered_instructor_tasks

tasks = _get_filtered_instructor_tasks(course_id, request.user, CANVAS_TASK_TYPES)
else:
# If no problem or student, just get currently running tasks
tasks = task_api.get_running_instructor_tasks(course_id)
Expand Down
11 changes: 0 additions & 11 deletions lms/djangoapps/instructor_task/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ def get_running_instructor_tasks(course_id):
return instructor_tasks.order_by('-id')


def get_running_instructor_canvas_tasks(course_id, user):
"""
Returns a query of InstructorTask objects of running tasks for a given course
including canvas-specific tasks.
"""
# Inline import because we will install the plugin separately
from ol_openedx_canvas_integration.constants import CANVAS_TASK_TYPES # pylint: disable=import-error
from ol_openedx_canvas_integration.task_helpers import _get_filtered_instructor_tasks
return _get_filtered_instructor_tasks(course_id, user, CANVAS_TASK_TYPES)


def get_instructor_task_history(course_id, usage_key=None, student=None, task_type=None):
"""
Returns a query of InstructorTask objects of historical tasks for a given course,
Expand Down

0 comments on commit 3a4d591

Please sign in to comment.