Commit 1b9caa8a by Bessie Steinberg

improve readability again

parent c34a0aac
......@@ -4,6 +4,7 @@ LMS Course Home page object
from collections import OrderedDict
import logging
from bok_choy.page_object import PageObject
from .bookmarks import BookmarksPage
......@@ -11,7 +12,6 @@ from .course_page import CoursePage
from .courseware import CoursewarePage
from .staff_view import StaffPreviewPage
import logging
log = logging.getLogger(__name__)
class CourseHomePage(CoursePage):
......
......@@ -46,18 +46,19 @@ class CourseOutlineFragmentView(EdxFragmentView):
"""
Returns dict of subsections with prerequisites and whether the prerequisite has been completed or not
"""
course_content_milestones = {}
all_course_prereqs = get_course_content_milestones(course_id=course_key)
all_course_prereqs = get_course_content_milestones(course_key)
for milestone in all_course_prereqs:
course_content_milestones[milestone['content_id']] = {'completed_prereqs': True}
content_ids_of_unfulfilled_prereqs = [
milestone['content_id']
for milestone in get_course_content_milestones(course_key, user_id=request.user.id)
]
unfulfilled_prereqs = get_course_content_milestones(
course_id=course_key,
user_id=request.user.id)
for milestone in unfulfilled_prereqs:
course_content_milestones[milestone['content_id']]['completed_prereqs'] = False
course_content_milestones = {
milestone['content_id']: {
'completed_prereqs': milestone['content_id'] not in content_ids_of_unfulfilled_prereqs
}
for milestone in all_course_prereqs
}
return course_content_milestones
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