Leftover name->url_name fixes
This commit is contained in:
@@ -87,8 +87,9 @@ def path_to_location(modulestore, location, course_name=None):
|
||||
|
||||
n = len(path)
|
||||
course_id = CourseDescriptor.location_to_id(path[0])
|
||||
chapter = path[1].url_name if n > 1 else None
|
||||
section = path[2].url_name if n > 2 else None
|
||||
# pull out the location names
|
||||
chapter = path[1].name if n > 1 else None
|
||||
section = path[2].name if n > 2 else None
|
||||
|
||||
# TODO (vshnayder): not handling position at all yet...
|
||||
position = None
|
||||
|
||||
@@ -74,8 +74,8 @@ def grade_sheet(student, course, grader, student_module_cache):
|
||||
totaled_scores[format] = format_scores
|
||||
|
||||
sections.append({
|
||||
'display_name': s.metadata.get('display_name'),
|
||||
'url_name': s.metadata.get('url_name'),
|
||||
'display_name': s.display_name,
|
||||
'url_name': s.url_name,
|
||||
'scores': scores,
|
||||
'section_total': section_total,
|
||||
'format': format,
|
||||
@@ -83,9 +83,9 @@ def grade_sheet(student, course, grader, student_module_cache):
|
||||
'graded': graded,
|
||||
})
|
||||
|
||||
chapters.append({'course': course.metadata.get('display_name'),
|
||||
'display_name': c.metadata.get('display_name'),
|
||||
'url_name': c.metadata.get('url_name'),
|
||||
chapters.append({'course': course.display_name,
|
||||
'display_name': c.display_name,
|
||||
'url_name': c.url_name,
|
||||
'sections': sections})
|
||||
|
||||
grade_summary = grader.grade(totaled_scores)
|
||||
|
||||
@@ -56,21 +56,21 @@ def toc_for_course(user, request, course, active_chapter, active_section):
|
||||
sections = list()
|
||||
for section in chapter.get_display_items():
|
||||
|
||||
active = (chapter.metadata.get('display_name') == active_chapter and
|
||||
section.metadata.get('display_name') == active_section)
|
||||
active = (chapter.display_name == active_chapter and
|
||||
section.display_name == active_section)
|
||||
hide_from_toc = section.metadata.get('hide_from_toc', 'false').lower() == 'true'
|
||||
|
||||
if not hide_from_toc:
|
||||
sections.append({'display_name': section.metadata.get('display_name'),
|
||||
'url_name': section.metadata.get('url_name'),
|
||||
sections.append({'display_name': section.display_name,
|
||||
'url_name': section.url_name,
|
||||
'format': section.metadata.get('format', ''),
|
||||
'due': section.metadata.get('due', ''),
|
||||
'active': active})
|
||||
|
||||
chapters.append({'display_name': chapter.metadata.get('display_name'),
|
||||
'url_name': chapter.metadata.get('url_name'),
|
||||
chapters.append({'display_name': chapter.display_name,
|
||||
'url_name': chapter.url_name,
|
||||
'sections': sections,
|
||||
'active': chapter.metadata.get('display_name') == active_chapter})
|
||||
'active': chapter.display_name == active_chapter})
|
||||
return chapters
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def get_section(course_module, chapter, section):
|
||||
|
||||
chapter_module = None
|
||||
for _chapter in course_module.get_children():
|
||||
if _chapter.metadata.get('url_name') == chapter:
|
||||
if _chapter.url_name == chapter:
|
||||
chapter_module = _chapter
|
||||
break
|
||||
|
||||
@@ -98,7 +98,7 @@ def get_section(course_module, chapter, section):
|
||||
|
||||
section_module = None
|
||||
for _section in chapter_module.get_children():
|
||||
if _section.metadata.get('url_name') == section:
|
||||
if _section.url_name == section:
|
||||
section_module = _section
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user