-
Notifications
You must be signed in to change notification settings - Fork 4.3k
EnrollmentTrackUserPartition to be used for differentiated content #14731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
|
|
||
| from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration | ||
| from openedx.core.djangoapps.site_configuration.models import SiteConfiguration | ||
| from xmodule.partitions.partitions_service import get_all_partitions_for_course | ||
|
|
||
| from xmodule.modulestore import ModuleStoreEnum | ||
| from xmodule.modulestore.django import modulestore | ||
|
|
@@ -373,11 +374,11 @@ def get_user_partition_info(xblock, schemes=None, course=None): | |
| schemes = set(schemes) | ||
|
|
||
| partitions = [] | ||
| for p in sorted(course.user_partitions, key=lambda p: p.name): | ||
| for p in sorted(get_all_partitions_for_course(course, active_only=True), key=lambda p: p.name): | ||
|
|
||
| # Exclude disabled partitions, partitions with no groups defined | ||
| # Also filter by scheme name if there's a filter defined. | ||
| if p.active and p.groups and (schemes is None or p.scheme.name in schemes): | ||
| if p.groups and (schemes is None or p.scheme.name in schemes): | ||
|
|
||
| # First, add groups defined by the partition | ||
| groups = [] | ||
|
|
@@ -408,7 +409,7 @@ def get_user_partition_info(xblock, schemes=None, course=None): | |
| # Put together the entire partition dictionary | ||
| partitions.append({ | ||
| "id": p.id, | ||
| "name": p.name, | ||
| "name": unicode(p.name), # Convert into a string in case ugettext_lazy was used | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: I had to add this because the EnrollmentTrackUserPartition uses ugettext_lazy (due to the fact that it lives in common.lib.xmodule.xmodule). When CMS unit tests ran, p.name was a function instead of a string, and JSON encoding failed. |
||
| "scheme": p.scheme.name, | ||
| "groups": groups, | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,8 @@ | |
| FEATURES['ENABLE_MOBILE_REST_API'] = True # Enable video bumper in Studio | ||
| FEATURES['ENABLE_VIDEO_BUMPER'] = True # Enable video bumper in Studio settings | ||
|
|
||
| FEATURES['ENABLE_ENROLLMENT_TRACK_USER_PARTITION'] = True | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewers: feature flag was introduced because the next story will add the ability to set component visibility based on this new partition. @sstack22 doesn't want course authors seeing this functionality before the other parts (including the ability to segment discussions) are present. Hopefully this feature flag will be deleted once everything is complete, as our plan is to make the feature invisible for courses where only a single enrollment track exists. I have enabled the feature flag for all unit and bok choy tests to ensure we are testing in those environments with the EnrollmentTrackUserPartition present (to catch any potential issues earlier).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, in the future, consider using a waffle switch in these cases. This way, you wouldn't need to be blocked on a release in order to enable/disable the feature. I've been using it for several features now, and created helper waffle utility classes: https://github.com/edx/edx-platform/blob/master/openedx/core/djangolib/waffle_utils.py
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the pointer-- definitely next time! |
||
|
|
||
| # Enable partner support link in Studio footer | ||
| PARTNER_SUPPORT_EMAIL = 'partner-support@example.com' | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers: exclude the enrollment_track partition.