Make display_name defaulting explicit
This commit is contained in:
@@ -95,7 +95,7 @@ def course_wiki_redirect(request, course_id):
|
||||
root,
|
||||
course_slug,
|
||||
title=course_slug,
|
||||
content="This is the wiki for **{0}**'s _{1}_.".format(course.org, course.lms.display_name),
|
||||
content="This is the wiki for **{0}**'s _{1}_.".format(course.org, course.display_name_with_default),
|
||||
user_message="Course page automatically created.",
|
||||
user=None,
|
||||
ip_address=None,
|
||||
|
||||
@@ -178,9 +178,7 @@ def get_course_about_section(course, section_key):
|
||||
key=section_key, url=course.location.url()))
|
||||
return None
|
||||
elif section_key == "title":
|
||||
if course.display_name is None:
|
||||
return course.url_name
|
||||
return course.display_name
|
||||
return course.display_name_with_default
|
||||
elif section_key == "university":
|
||||
return course.location.org
|
||||
elif section_key == "number":
|
||||
|
||||
@@ -81,8 +81,8 @@ def get_courseware_with_tabs(course_id):
|
||||
|
||||
course = get_course_by_id(course_id)
|
||||
chapters = [chapter for chapter in course.get_children() if not chapter.lms.hide_from_toc]
|
||||
courseware = [{'chapter_name': c.display_name,
|
||||
'sections': [{'section_name': s.display_name,
|
||||
courseware = [{'chapter_name': c.display_name_with_default,
|
||||
'sections': [{'section_name': s.display_name_with_default,
|
||||
'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0,
|
||||
'tabs': [{'children_count': len(t.get_children()) if (type(t) == vertical_module.VerticalDescriptor) else 0,
|
||||
'class': t.__class__.__name__}
|
||||
|
||||
@@ -115,7 +115,7 @@ def answer_distributions(request, course):
|
||||
for problem_id in capa_module.lcp.student_answers:
|
||||
# Answer can be a list or some other unhashable element. Convert to string.
|
||||
answer = str(capa_module.lcp.student_answers[problem_id])
|
||||
key = (capa_module.url_name, capa_module.display_name, problem_id)
|
||||
key = (capa_module.url_name, capa_module.display_name_with_default, problem_id)
|
||||
counts[key][answer] += 1
|
||||
|
||||
return counts
|
||||
@@ -153,7 +153,7 @@ def grade(student, request, course, model_data_cache=None, keep_raw_scores=False
|
||||
format_scores = []
|
||||
for section in sections:
|
||||
section_descriptor = section['section_descriptor']
|
||||
section_name = section_descriptor.lms.display_name
|
||||
section_name = section_descriptor.display_name_with_default
|
||||
|
||||
should_grade_section = False
|
||||
# If we haven't seen a single problem in the section, we don't have to grade it at all! We can assume 0%
|
||||
@@ -195,7 +195,7 @@ def grade(student, request, course, model_data_cache=None, keep_raw_scores=False
|
||||
#We simply cannot grade a problem that is 12/0, because we might need it as a percentage
|
||||
graded = False
|
||||
|
||||
scores.append(Score(correct, total, graded, module_descriptor.lms.display_name))
|
||||
scores.append(Score(correct, total, graded, module_descriptor.display_name_with_default))
|
||||
|
||||
section_total, graded_total = graders.aggregate_scores(scores, section_name)
|
||||
if keep_raw_scores:
|
||||
@@ -311,15 +311,15 @@ def progress_summary(student, request, course, model_data_cache):
|
||||
continue
|
||||
|
||||
scores.append(Score(correct, total, graded,
|
||||
module_descriptor.lms.display_name))
|
||||
module_descriptor.display_name_with_default))
|
||||
|
||||
scores.reverse()
|
||||
section_total, graded_total = graders.aggregate_scores(
|
||||
scores, section_module.lms.display_name)
|
||||
scores, section_module.display_name_with_default)
|
||||
|
||||
format = section_module.lms.format
|
||||
sections.append({
|
||||
'display_name': section_module.lms.display_name,
|
||||
'display_name': section_module.display_name_with_default,
|
||||
'url_name': section_module.url_name,
|
||||
'scores': scores,
|
||||
'section_total': section_total,
|
||||
@@ -328,8 +328,8 @@ def progress_summary(student, request, course, model_data_cache):
|
||||
'graded': graded,
|
||||
})
|
||||
|
||||
chapters.append({'course': course.lms.display_name,
|
||||
'display_name': chapter_module.lms.display_name,
|
||||
chapters.append({'course': course.display_name_with_default,
|
||||
'display_name': chapter_module.display_name_with_default,
|
||||
'url_name': chapter_module.url_name,
|
||||
'sections': sections})
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ def toc_for_course(user, request, course, active_chapter, active_section, model_
|
||||
section.url_name == active_section)
|
||||
|
||||
if not section.lms.hide_from_toc:
|
||||
sections.append({'display_name': section.lms.display_name,
|
||||
sections.append({'display_name': section.display_name_with_default,
|
||||
'url_name': section.url_name,
|
||||
'format': section.lms.format,
|
||||
'due': section.lms.due,
|
||||
@@ -109,7 +109,7 @@ def toc_for_course(user, request, course, active_chapter, active_section, model_
|
||||
'graded': section.lms.graded,
|
||||
})
|
||||
|
||||
chapters.append({'display_name': chapter.lms.display_name,
|
||||
chapters.append({'display_name': chapter.display_name_with_default,
|
||||
'url_name': chapter.url_name,
|
||||
'sections': sections,
|
||||
'active': chapter.url_name == active_chapter})
|
||||
|
||||
@@ -282,7 +282,7 @@ def index(request, course_id, chapter=None, section=None,
|
||||
context = {
|
||||
'csrf': csrf(request)['csrf_token'],
|
||||
'accordion': render_accordion(request, course, chapter, section, model_data_cache),
|
||||
'COURSE_TITLE': course.lms.display_name,
|
||||
'COURSE_TITLE': course.display_name_with_default,
|
||||
'course': course,
|
||||
'init': '',
|
||||
'content': '',
|
||||
|
||||
@@ -128,7 +128,7 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
|
||||
|
||||
for cdir, course in def_ms.courses.items():
|
||||
html += '<hr width="100%"/>'
|
||||
html += '<h2>Course: %s (%s)</h2>' % (course.display_name, cdir)
|
||||
html += '<h2>Course: %s (%s)</h2>' % (course.display_name_with_default, cdir)
|
||||
|
||||
html += '<p>commit_id=%s</p>' % get_commit_id(course)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ def _message(reqm, message):
|
||||
return message.format(link="<a href={url}>{url_name}</a>".format(
|
||||
url = reverse('jump_to', kwargs=dict(course_id=get_course_id(reqm),
|
||||
location=reqm.location.url())),
|
||||
url_name = reqm.display_name))
|
||||
url_name = reqm.display_name_with_default))
|
||||
%>
|
||||
% if message:
|
||||
% for reqm in module.required_modules:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<h2>${chapter_module.lms.display_name}</h2>
|
||||
<h2>${chapter_module.display_name_with_default}</h2>
|
||||
|
||||
<p>You were most recently in <a href="${prev_section_url}">${prev_section.lms.display_name}</a>. If you're done with that, choose another section on the left.</p>
|
||||
<p>You were most recently in <a href="${prev_section_url}">${prev_section.display_name_with_default}</a>. If you're done with that, choose another section on the left.</p>
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
% endif
|
||||
</p>
|
||||
<h2 class="university">${get_course_about_section(course, 'university')}</h2>
|
||||
<h3><a href="${course_target}">${course.number} ${course.lms.display_name}</a></h3>
|
||||
<h3><a href="${course_target}">${course.number} ${course.display_name_with_default}</a></h3>
|
||||
</hgroup>
|
||||
|
||||
<%
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="sidebar"></div>
|
||||
<div class="discussion-column">
|
||||
<div class="discussion-article blank-slate">
|
||||
<h1>${course.lms.display_name} Discussion</h1>
|
||||
<h1>${course.display_name_with_default} Discussion</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
<h1 class="logo"><a href="${reverse('root')}"><img src="${static.url(branding.get_logo_url(request.META.get('HTTP_HOST')))}"/></a></h1>
|
||||
|
||||
% if course:
|
||||
<h2><span class="provider">${course.org}:</span> ${course.number} ${course.lms.display_name}</h2>
|
||||
<h2><span class="provider">${course.org}:</span> ${course.number} ${course.display_name_with_default}</h2>
|
||||
% endif
|
||||
|
||||
<ol class="left find-courses-button">
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<section class="introduction">
|
||||
<header>
|
||||
<hgroup>
|
||||
<h2><a href="${reverse('dashboard')}">${get_course_about_section(course, 'university')} ${course.number} ${course.lms.display_name}</a></h2>
|
||||
<h2><a href="${reverse('dashboard')}">${get_course_about_section(course, 'university')} ${course.number} ${course.display_name_with_default}</a></h2>
|
||||
|
||||
% if registration:
|
||||
<h1>Your Pearson VUE Proctored Exam Registration</h1>
|
||||
@@ -457,7 +457,7 @@
|
||||
% if exam_info is not None:
|
||||
<ul>
|
||||
<li>
|
||||
<span class="label">Exam Name:</span> <span class="value">${exam_info.display_name}</span>
|
||||
<span class="label">Exam Name:</span> <span class="value">${exam_info.display_name_with_default}</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label">First Eligible Appointment Date:</span> <span class="value">${exam_info.first_eligible_appointment_date_text}</span>
|
||||
|
||||
@@ -27,11 +27,6 @@ class LmsNamespace(Namespace):
|
||||
default='',
|
||||
)
|
||||
|
||||
display_name = String(
|
||||
help="Display name for this module",
|
||||
scope=Scope.settings,
|
||||
computed_default=lambda module: module.url_name.replace('_', ' ')
|
||||
)
|
||||
start = Date(help="Start time when this module is visible", scope=Scope.settings)
|
||||
due = String(help="Date that this problem is due by", scope=Scope.settings, default='')
|
||||
source_file = String(help="DO NOT USE", scope=Scope.settings)
|
||||
|
||||
Reference in New Issue
Block a user