Skip to content

Commit

Permalink
refactor: move more code into the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
arslanashraf7 committed Oct 29, 2024
1 parent f470598 commit 1c34f29
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
19 changes: 1 addition & 18 deletions lms/djangoapps/instructor_task/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,14 @@ def get_running_instructor_tasks(course_id):
return instructor_tasks.order_by('-id')


def _get_filtered_instructor_tasks(course_id, user, task_types):
"""
Returns a filtered query of InstructorTasks based on the course, user, and desired task types
"""
instructor_tasks = get_running_instructor_tasks(course_id)
now = datetime.datetime.now(pytz.utc)
filtered_tasks = InstructorTask.objects.filter(
course_id=course_id,
task_type__in=task_types,
updated__lte=now,
updated__gte=now - datetime.timedelta(days=2),
requester=user
).order_by('-updated')

return (instructor_tasks | filtered_tasks).distinct()[0:3]


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)


Expand Down
7 changes: 0 additions & 7 deletions xmodule/course_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,6 @@ class CourseFields: # lint-amnesty, pylint: disable=missing-class-docstring
),
scope=Scope.settings
)
canvas_course_id = Integer(
display_name=_("Canvas Course Id"),
help=_(
"The id for the corresponding course on Canvas"
),
scope=Scope.settings
)
enable_ccx = Boolean(
# Translators: Custom Courses for edX (CCX) is an edX feature for re-using course content. CCX Coach is
# a role created by a course Instructor to enable a person (the "Coach") to manage the custom course for
Expand Down

0 comments on commit 1c34f29

Please sign in to comment.