Skip to content
Snippets Groups Projects
Unverified Commit 484d9166 authored by Calen Pennington's avatar Calen Pennington Committed by GitHub
Browse files

Merge pull request #20218 from cpennington/fbe-improve-support-form

Show complete reason on both content type gating and course duration …
parents 41462f47 446db3ac
No related merge requests found
...@@ -28,7 +28,7 @@ class FeatureBasedEnrollmentsSupportView(View): ...@@ -28,7 +28,7 @@ class FeatureBasedEnrollmentsSupportView(View):
if course_key: if course_key:
results = self._get_course_duration_info(course_key) results = self._get_course_duration_info(course_key)
else: else:
results = [] results = {}
return render_to_response('support/feature_based_enrollments.html', { return render_to_response('support/feature_based_enrollments.html', {
'course_key': course_key, 'course_key': course_key,
...@@ -39,14 +39,12 @@ class FeatureBasedEnrollmentsSupportView(View): ...@@ -39,14 +39,12 @@ class FeatureBasedEnrollmentsSupportView(View):
""" """
Fetch course duration information from database Fetch course duration information from database
""" """
results = []
try: try:
key = CourseKey.from_string(course_key) key = CourseKey.from_string(course_key)
course = CourseOverview.objects.values('display_name').get(id=key) course = CourseOverview.objects.values('display_name').get(id=key)
duration_config = CourseDurationLimitConfig.current(course_key=key) duration_config = CourseDurationLimitConfig.current(course_key=key)
gating_config = ContentTypeGatingConfig.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 partially_enabled:
if duration_config.enabled: if duration_config.enabled:
...@@ -62,16 +60,12 @@ class FeatureBasedEnrollmentsSupportView(View): ...@@ -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' enabled_as_of = str(duration_config.enabled_as_of) if duration_config.enabled_as_of else 'N/A'
reason = duration_config.provenances['enabled'] reason = duration_config.provenances['enabled']
data = { return {
'course_id': course_key, 'course_id': course_key,
'course_name': course.get('display_name'), 'course_name': course.get('display_name'),
'enabled': enabled, 'gating_config': gating_config,
'enabled_as_of': enabled_as_of, 'duration_config': duration_config,
'reason': reason,
} }
results.append(data)
except (ObjectDoesNotExist, InvalidKeyError): except (ObjectDoesNotExist, InvalidKeyError):
pass return {}
return results
...@@ -213,6 +213,10 @@ ...@@ -213,6 +213,10 @@
} }
} }
.fb-enrollments-gating-col{
background-color: #eee;
}
.contact-us-wrapper { .contact-us-wrapper {
min-width: auto; min-width: auto;
......
...@@ -24,27 +24,43 @@ ${_("Feature Based Enrollments")} ...@@ -24,27 +24,43 @@ ${_("Feature Based Enrollments")}
</div> </div>
<div class="fb-enrollments-results"> <div class="fb-enrollments-results">
% if len(results) > 0: % if results:
<table id="fb-enrollments-table" class="fb-enrollments-table display compact nowrap"> <table id="fb-enrollments-table" class="fb-enrollments-table display compact nowrap">
<thead> <thead>
<tr> <tr>
<th>${_("Course ID")}</th> <th>${_("Course ID")}</th>
<th>${_("Course Name")}</th> <th>${_("Course Name")}</th>
<th>${_("Is Enabled")}</th> <th class="fb-enrollments-gating-col" colspan=3>${_("Content Type Gating")}</th>
<th>${_("Enabled As Of")}</th> <th colspan=3>${_("Course Duration Limits")}</th>
<th>${_("Reason")}</th> </tr>
<tr>
<th></th>
<th></th>
<th class="fb-enrollments-gating-col">${_("Is Enabled")}</th>
<th class="fb-enrollments-gating-col">${_("Enabled As Of")}</th>
<th class="fb-enrollments-gating-col">${_("Reason")}</th>
<th>${_("Is Enabled")}</th>
<th>${_("Enabled As Of")}</th>
<th>${_("Reason")}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
% for data in results:
<tr> <tr>
<td>${data.get('course_id')}</td> <td>${results['course_id']}</td>
<td>${data.get('course_name')}</td> <td>${results['course_name']}</td>
<td>${data.get('enabled')}</td> <td class="fb-enrollments-gating-col">
<td>${data.get('enabled_as_of')}</td> ${results['gating_config'].enabled if results['gating_config'].enabled is not None else 'Unknown'}
<td>${data.get('reason')}</td> </td>
<td class="fb-enrollments-gating-col">
${results['gating_config'].enabled_as_of if results['gating_config'].enabled_as_of is not None else 'N/A'}
</td>
<td class="fb-enrollments-gating-col">
${results['gating_config'].provenances['enabled'].value}
</td>
<td>${results['duration_config'].enabled if results['duration_config'].enabled is not None else 'Unknown'}</td>
<td>${results['duration_config'].enabled_as_of if results['duration_config'].enabled_as_of is not None else 'N/A'}</td>
<td>${results['duration_config'].provenances['enabled'].value}</td>
</tr> </tr>
% endfor
</tbody> </tbody>
</table> </table>
% elif course_key: % elif course_key:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment