From bc5e27fe171ca06e374102a598b7ed80fd3da75a Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 19 Aug 2013 13:57:16 -0400 Subject: [PATCH] update some more call sites in LMS to always pass in a course_id --- lms/djangoapps/courseware/tests/tests.py | 2 +- lms/djangoapps/instructor/hint_manager.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index cd245d2610..68b06a1ba8 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -64,7 +64,7 @@ class PageLoaderTestCase(LoginEnrollmentTestCase): location_query = Location(course_loc.tag, course_loc.org, course_loc.course, None, None, None) - items = module_store.get_items(location_query) + items = module_store.get_items(location_query, course_id=course_id) if len(items) < 1: self.fail('Could not retrieve any items from course') diff --git a/lms/djangoapps/instructor/hint_manager.py b/lms/djangoapps/instructor/hint_manager.py index 73c4ba220f..899e386f70 100644 --- a/lms/djangoapps/instructor/hint_manager.py +++ b/lms/djangoapps/instructor/hint_manager.py @@ -89,7 +89,7 @@ def get_hints(request, course_id, field): for hints_by_problem in all_hints: loc = Location(hints_by_problem.definition_id) - name = location_to_problem_name(loc) + name = location_to_problem_name(course_id, loc) if name is None: continue id_to_name[hints_by_problem.definition_id] = name @@ -119,13 +119,13 @@ def get_hints(request, course_id, field): return render_dict -def location_to_problem_name(loc): +def location_to_problem_name(course_id, loc): """ Given the location of a crowdsource_hinter module, try to return the name of the problem it wraps around. Return None if the hinter no longer exists. """ try: - descriptor = modulestore().get_items(loc)[0] + descriptor = modulestore().get_items(loc, course_id=course_id)[0] return descriptor.get_children()[0].display_name except IndexError: # Sometimes, the problem is no longer in the course. Just