From 446db3ac53795fdec71132a8faafd2c33bdde42b Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 11 Apr 2019 12:33:58 -0400 Subject: [PATCH] Show complete reason on both content type gating and course duration limits in support form --- .../views/feature_based_enrollments.py | 18 +++----- lms/static/sass/views/_support.scss | 4 ++ .../support/feature_based_enrollments.html | 42 +++++++++++++------ 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/lms/djangoapps/support/views/feature_based_enrollments.py b/lms/djangoapps/support/views/feature_based_enrollments.py index 95125b5e19..1a73f81540 100644 --- a/lms/djangoapps/support/views/feature_based_enrollments.py +++ b/lms/djangoapps/support/views/feature_based_enrollments.py @@ -28,7 +28,7 @@ class FeatureBasedEnrollmentsSupportView(View): if course_key: results = self._get_course_duration_info(course_key) else: - results = [] + results = {} return render_to_response('support/feature_based_enrollments.html', { 'course_key': course_key, @@ -39,14 +39,12 @@ class FeatureBasedEnrollmentsSupportView(View): """ Fetch course duration information from database """ - results = [] - try: key = CourseKey.from_string(course_key) course = CourseOverview.objects.values('display_name').get(id=key) duration_config = CourseDurationLimitConfig.current(course_key=key) gating_config = ContentTypeGatingConfig.current(course_key=key) - partially_enabled = duration_config.enabled != gating_config.enabled + partially_enabled = bool(duration_config.enabled) != bool(gating_config.enabled) if partially_enabled: if duration_config.enabled: @@ -62,16 +60,12 @@ class FeatureBasedEnrollmentsSupportView(View): enabled_as_of = str(duration_config.enabled_as_of) if duration_config.enabled_as_of else 'N/A' reason = duration_config.provenances['enabled'] - data = { + return { 'course_id': course_key, 'course_name': course.get('display_name'), - 'enabled': enabled, - 'enabled_as_of': enabled_as_of, - 'reason': reason, + 'gating_config': gating_config, + 'duration_config': duration_config, } - results.append(data) except (ObjectDoesNotExist, InvalidKeyError): - pass - - return results + return {} diff --git a/lms/static/sass/views/_support.scss b/lms/static/sass/views/_support.scss index 0c8391d4e5..74d88982c3 100644 --- a/lms/static/sass/views/_support.scss +++ b/lms/static/sass/views/_support.scss @@ -213,6 +213,10 @@ } } +.fb-enrollments-gating-col{ + background-color: #eee; +} + .contact-us-wrapper { min-width: auto; diff --git a/lms/templates/support/feature_based_enrollments.html b/lms/templates/support/feature_based_enrollments.html index 38d312598b..ed28720be4 100644 --- a/lms/templates/support/feature_based_enrollments.html +++ b/lms/templates/support/feature_based_enrollments.html @@ -24,27 +24,43 @@ ${_("Feature Based Enrollments")}
- % if len(results) > 0: + % if results: - - - - - + + + + + + + + + + + + + + - % for data in results: - - - - - + + + + + + + + - % endfor
${_("Course ID")}${_("Course Name")}${_("Is Enabled")}${_("Enabled As Of")}${_("Reason")}${_("Course ID")}${_("Course Name")}${_("Content Type Gating")}${_("Course Duration Limits")}
${_("Is Enabled")}${_("Enabled As Of")}${_("Reason")}${_("Is Enabled")}${_("Enabled As Of")}${_("Reason")}
${data.get('course_id')}${data.get('course_name')}${data.get('enabled')}${data.get('enabled_as_of')}${data.get('reason')}${results['course_id']}${results['course_name']} + ${results['gating_config'].enabled if results['gating_config'].enabled is not None else 'Unknown'} + + ${results['gating_config'].enabled_as_of if results['gating_config'].enabled_as_of is not None else 'N/A'} + + ${results['gating_config'].provenances['enabled'].value} + ${results['duration_config'].enabled if results['duration_config'].enabled is not None else 'Unknown'}${results['duration_config'].enabled_as_of if results['duration_config'].enabled_as_of is not None else 'N/A'}${results['duration_config'].provenances['enabled'].value}
% elif course_key: