Commit 905199b5 by Chris Dodge

restore metadata inheritance. Fix lms jump computation on the Studio index page.…

restore metadata inheritance. Fix lms jump computation on the Studio index page. This gets expensive.
parent e42cdfbd
......@@ -75,12 +75,15 @@ def get_course_for_item(location):
return courses[0]
def get_lms_link_for_item(location, preview=False):
def get_lms_link_for_item(location, course_id=None, preview=False):
if course_id is None:
course_id = get_course_id(location)
if settings.LMS_BASE is not None:
lms_link = "//{preview}{lms_base}/courses/{course_id}/jump_to/{location}".format(
preview='preview.' if preview else '',
lms_base=settings.LMS_BASE,
course_id=get_course_id(location),
course_id= course_id,
location=Location(location)
)
else:
......
......@@ -114,7 +114,7 @@ def index(request):
"""
List all courses available to the logged in user
"""
courses = modulestore().get_items(['i4x', None, None, 'course', None])
courses = modulestore('direct').get_items(['i4x', None, None, 'course', None])
# filter out courses that we don't have access too
def course_filter(course):
......@@ -132,7 +132,7 @@ def index(request):
course.location.org,
course.location.course,
course.location.name]),
get_lms_link_for_item(course.location))
get_lms_link_for_item(course.location, course_id=course.location.course_id))
for course in courses],
'user': request.user,
'disable_course_creation': settings.MITX_FEATURES.get('DISABLE_COURSE_CREATION', False) and not request.user.is_staff
......
......@@ -3,6 +3,7 @@ import sys
import logging
import copy
import time
import traceback
from bson.son import SON
from fs.osfs import OSFS
......@@ -289,8 +290,8 @@ class MongoModuleStore(ModuleStoreBase):
# if we are loading a course object, there is no parent to inherit the metadata from
# so don't bother getting it
#if item['location']['category'] != 'course':
# metadata_inheritance_tree = self.get_cached_metadata_inheritance_tree(Location(item['location']), 300)
if item['location']['category'] != 'course':
metadata_inheritance_tree = self.get_cached_metadata_inheritance_tree(Location(item['location']), 300)
# TODO (cdodge): When the 'split module store' work has been completed, we should remove
# the 'metadata_inheritance_tree' parameter
......
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