From 1fec3b997bd12645212841b2d5367cb73cf41fb8 Mon Sep 17 00:00:00 2001 From: Matthew Piatetsky Date: Wed, 15 Jul 2020 15:43:57 -0400 Subject: [PATCH] Revert "[REV-774] Show content type gating upsell when a limited access learner tries to access a timed exam" --- common/lib/xmodule/xmodule/seq_module.py | 34 +----------------------- lms/templates/seq_module.html | 7 ----- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py index 06ebbaff69..6ee1f168c5 100644 --- a/common/lib/xmodule/xmodule/seq_module.py +++ b/common/lib/xmodule/xmodule/seq_module.py @@ -14,7 +14,6 @@ from functools import reduce from pkg_resources import resource_string import six -from django.contrib.auth.models import User from lxml import etree from opaque_keys.edx.keys import UsageKey from pytz import UTC @@ -197,7 +196,6 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): def __init__(self, *args, **kwargs): super(SequenceModule, self).__init__(*args, **kwargs) - self.gated_sequence_fragment = None # If position is specified in system, then use that instead. position = getattr(self.system, 'position', None) if position is not None: @@ -279,30 +277,6 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): prereq_met = True prereq_meta_info = {} - # Content type gating for FBE previously only gated individual blocks - # 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 - # This functionality still needs to be replicated in the frontend-app-learning courseware MFE - # The ticket to track this is https://openedx.atlassian.net/browse/REV-1220 - # Note that this will break compatability with using sequences outside of edx-platform - # but we are ok with this for now - if self.is_time_limited: - 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 - from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITION_ID - if ContentTypeGatingConfig.enabled_for_enrollment(user=user, course_key=self.runtime.course_id): - # Get the content type gating locked content fragment to render for this sequence - partition = self.descriptor._get_user_partition(CONTENT_GATING_PARTITION_ID) # pylint: disable=protected-access - user_group = partition.scheme.get_group_for_user(self.runtime.course_id, user, partition) - self.gated_sequence_fragment = partition.access_denied_fragment( - self.descriptor, user, user_group, [] - ) - except User.DoesNotExist: - pass - if self._required_prereq(): if self.runtime.user_is_staff: banner_text = _('This subsection is unlocked for learners when they meet the prerequisite requirements.') @@ -316,7 +290,6 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): banner_text, special_html = special_html_view if special_html and not masquerading_as_specific_student: return Fragment(special_html) - return self._student_or_public_view(context, prereq_met, prereq_meta_info, banner_text) def public_view(self, context): @@ -344,7 +317,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): staff is masquerading. """ _ = self.runtime.service(self, "i18n").ugettext - if self.is_time_limited and not self.gated_sequence_fragment: + if self.is_time_limited: special_exam_html = self._time_limited_student_view() if special_exam_html: banner_text = _("This exam is hidden from the learner.") @@ -396,7 +369,6 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): ) items = self._render_student_view_for_items(context, display_items, fragment, view) if prereq_met else [] - params = { 'items': items, 'element_id': self.location.html_id(), @@ -411,12 +383,8 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule): 'save_position': view != PUBLIC_VIEW, 'show_completion': view != PUBLIC_VIEW, 'gated_content': self._get_gated_content_info(prereq_met, prereq_meta_info), - 'sequence_name': self.display_name, 'exclude_units': context.get('exclude_units', False) } - if self.gated_sequence_fragment: - params['gated_sequence_fragment'] = self.gated_sequence_fragment.content - return params def _student_or_public_view(self, context, prereq_met, prereq_meta_info, banner_text=None, view=STUDENT_VIEW): diff --git a/lms/templates/seq_module.html b/lms/templates/seq_module.html index 68b99334d5..6a49a60b6e 100644 --- a/lms/templates/seq_module.html +++ b/lms/templates/seq_module.html @@ -21,7 +21,6 @@ % endif % endif - % if not gated_sequence_fragment:
- % endif % 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: -

- ${sequence_name}${_("Content Locked")} -

- ${gated_sequence_fragment | n, decode.utf8} % else: