This was the "outline tab" view of the course. Preceded by the
course info view, succeeded by the MFE outline tab.
In addition to the course home view itself, this drops related
features:
- Legacy version of Course Goals (MFE has a newer implementation)
- Course home in-course search (MFE has no search)
The old course info view and course about views survive for now.
This also drops a few now-unused feature toggles:
- course_experience.latest_update
- course_experience.show_upgrade_msg_on_course_home
- course_experience.upgrade_deadline_message
- course_home.course_home_use_legacy_frontend
With this change, just the progress and courseware tabs are still
supported in legacy form, if you opt-in with waffle flags. The
outline and dates tabs are offered only by the MFE.
AA-798
(This is identical to previous commit be5c1a6, just reintroduced
now that the e2e tests have been fixed)
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""
|
|
Course Goals Python API
|
|
"""
|
|
|
|
from opaque_keys.edx.keys import CourseKey
|
|
|
|
from lms.djangoapps.course_goals.models import CourseGoal
|
|
|
|
|
|
def add_course_goal(user, course_id, subscribed_to_reminders, days_per_week=None):
|
|
"""
|
|
Add a new course goal for the provided user and course. If the goal
|
|
already exists, simply update and save the goal.
|
|
|
|
Arguments:
|
|
user: The user that is setting the goal
|
|
course_id (string): The id for the course the goal refers to
|
|
subscribed_to_reminders (bool): whether the learner wants to receive email reminders about their goal
|
|
days_per_week (int): (optional) number of days learner wants to learn per week
|
|
"""
|
|
course_key = CourseKey.from_string(str(course_id))
|
|
defaults = {
|
|
'subscribed_to_reminders': subscribed_to_reminders,
|
|
}
|
|
if days_per_week:
|
|
defaults['days_per_week'] = days_per_week
|
|
CourseGoal.objects.update_or_create(
|
|
user=user, course_key=course_key, defaults=defaults
|
|
)
|
|
|
|
|
|
def get_course_goal(user, course_key):
|
|
"""
|
|
Given a user and a course_key, return their course goal.
|
|
|
|
If the user is anonymous or a course goal does not exist, returns None.
|
|
"""
|
|
if user.is_anonymous:
|
|
return None
|
|
|
|
return CourseGoal.objects.filter(user=user, course_key=course_key).first()
|