-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[REV-774] Show content type gating upsell when a limited access learner tries to access a timed exam #24214
Conversation
d68cf02
to
6a8f16c
Compare
self.content_type_gating_enabled = ContentTypeGatingConfig.enabled_for_enrollment(user=user, course_key=self.runtime.course_id) | ||
if self.content_type_gating_enabled: | ||
# Get the content type gating locked content fragment to render for this sequence | ||
partition = self.descriptor._get_user_partition(CONTENT_GATING_PARTITION_ID) |
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.
are there issues here where the partition could not be defined or the user could not have a group for that partition if a course is using some unusual configuration?
% if not exclude_units: | ||
% if gated_content['gated']: | ||
<%include file="_gated_content.html" args="prereq_url=gated_content['prereq_url'], prereq_section_name=gated_content['prereq_section_name'], gated_section_name=gated_content['gated_section_name']"/> | ||
% elif gated_sequence_fragment: |
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.
could a sequence include a timed exam and content outside of the timed exam in the same sequence?
6a8f16c
to
ece199c
Compare
try: | ||
user = User.objects.get(id=self.runtime.user_id) | ||
# importing here to avoid a circular import | ||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig |
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.
Rather than having this code live in the sequence module, it might be better to add knowledge to the block-transformer that currently actively gates graded problems. That way you wouldn't be dealing w/ this import cycle, and would instead be just adding knowledge of another kind of feature to be gated.
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.
Even if we're leaving this code here, I think it's worth a note about the future plans with the MFE to explain why this level of pulling in openedx features is warranted. (This breaks the ability to use this sequence block outside of edx-platform
, basically. I think we're ok w/ that, but it's worth a note).
@ormsbee, can you double check me on this?
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.
If we wanted to make it less likely to break outside of the platform, we could add another XBlock service that has access to content type gating information.
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.
Agreed on all points.
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.
@cpennington so should I do what you're suggesting? if so could you elaborate?
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.
Leave a note about this breaking compatibility w/ using sequence outside edx-platform, but don't do any further eng work on it.
28a0d14
to
c5b6466
Compare
# This was an issue because audit learners could start a timed exam and then be unable to complete the exam | ||
# even if they later upgrade because the timer would have expired. | ||
# For this reason we check if content gating is enabled for the user and gate the entire sequence in that case | ||
if self.is_time_limited and self.location.block_type == 'sequential': |
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.
Why does this have to check its own block_type
? Are there other flavors of sequential
using this same rendering code that shouldn't be time limited?
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.
i think this was left over from when i was trying to do this in the block transformers, i'll remove it
try: | ||
user = User.objects.get(id=self.runtime.user_id) | ||
# importing here to avoid a circular import | ||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig |
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.
Even if we're leaving this code here, I think it's worth a note about the future plans with the MFE to explain why this level of pulling in openedx features is warranted. (This breaks the ability to use this sequence block outside of edx-platform
, basically. I think we're ok w/ that, but it's worth a note).
@ormsbee, can you double check me on this?
try: | ||
user = User.objects.get(id=self.runtime.user_id) | ||
# importing here to avoid a circular import | ||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig |
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.
If we wanted to make it less likely to break outside of the platform, we could add another XBlock service that has access to content type gating information.
…o access a timed exam Otherwise, these learners could start the timer and then be unable to take the exam once they have access to the content REV-774
c5b6466
to
78317ca
Compare
Your PR has finished running tests. There were no failures. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
… flag (#25054) Re-applied bugfix #24214, but behind a waffle flag. The change gates timed exams for audit learners. We would like to limit access to timed exams to verified learners. However, some of the instructors would like to make their content free for all users, including graded content/timed exams (hence the Feature-Based Enrollment "FBE" exemption). As a result, we will be rolling the gated timed exams functionality out behind a waffle flag now, add the FBE exemption when we figure out how, and gradually turn the waffle flag on for everyone.
Otherwise, these learners could start the timer and then be unable to take the exam once they have access to the content
Before:
After:
Course Outline:
Don't think anything needs to be done here
Mobile:
I believe timed exams don't show up here anyway, so this should probably be fine?
Course API:
I don't think the html change would affect this
New Courseware MFE:
Have done a little bit of discovery into this, product will get back to me in terms of whether I should do the additional work for that as part of this ticket or another ticket