Commit 94e24c16 by Victor Shnayder

Leftover name->url_name fixes

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