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
Branches
Tags
No related merge requests found
......@@ -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 {}
......@@ -213,6 +213,10 @@
}
}
.fb-enrollments-gating-col{
background-color: #eee;
}
.contact-us-wrapper {
min-width: auto;
......
......@@ -24,27 +24,43 @@ ${_("Feature Based Enrollments")}
</div>
<div class="fb-enrollments-results">
% if len(results) > 0:
% if results:
<table id="fb-enrollments-table" class="fb-enrollments-table display compact nowrap">
<thead>
<tr>
<th>${_("Course ID")}</th>
<th>${_("Course Name")}</th>
<th>${_("Is Enabled")}</th>
<th>${_("Enabled As Of")}</th>
<th>${_("Reason")}</th>
<th>${_("Course ID")}</th>
<th>${_("Course Name")}</th>
<th class="fb-enrollments-gating-col" colspan=3>${_("Content Type Gating")}</th>
<th colspan=3>${_("Course Duration Limits")}</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>
</thead>
<tbody>
% for data in results:
<tr>
<td>${data.get('course_id')}</td>
<td>${data.get('course_name')}</td>
<td>${data.get('enabled')}</td>
<td>${data.get('enabled_as_of')}</td>
<td>${data.get('reason')}</td>
<td>${results['course_id']}</td>
<td>${results['course_name']}</td>
<td class="fb-enrollments-gating-col">
${results['gating_config'].enabled if results['gating_config'].enabled is not None else 'Unknown'}
</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>
% endfor
</tbody>
</table>
% elif course_key:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment