Skip to content
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

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

MatthewPiatetsky
Copy link
Contributor

@MatthewPiatetsky MatthewPiatetsky commented Jun 12, 2020

Otherwise, these learners could start the timer and then be unable to take the exam once they have access to the content
Before:
Screen Shot 2020-06-15 at 10 53 10 AM
After:
Screen Shot 2020-06-15 at 11 10 55 AM

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

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)
Copy link
Contributor Author

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:
Copy link
Contributor Author

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?

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
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on all points.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@MatthewPiatetsky MatthewPiatetsky changed the title [WIP] [REV-774] Show content type gating upsell when a limited access learner tries to access a timed exam [REV-774] Show content type gating upsell when a limited access learner tries to access a timed exam Jun 17, 2020
# 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':
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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
@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@MatthewPiatetsky MatthewPiatetsky merged commit b3c2d37 into master Jun 23, 2020
@MatthewPiatetsky MatthewPiatetsky deleted the REV-774 branch June 23, 2020 15:48
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

jhan217 pushed a commit that referenced this pull request Oct 1, 2020
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants