Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c33571ff
Commit
c33571ff
authored
Aug 19, 2013
by
chrisndodge
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #732 from edx/fix/cdodge/get_items_needs_courseid
Fix/cdodge/get items needs courseid
parents
63c65484
6a3dafee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
lms/djangoapps/courseware/tests/tests.py
+1
-1
lms/djangoapps/courseware/views.py
+4
-1
lms/djangoapps/instructor/hint_manager.py
+3
-3
lms/djangoapps/instructor/tests/test_hint_manager.py
+1
-1
No files found.
lms/djangoapps/courseware/tests/tests.py
View file @
c33571ff
...
...
@@ -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'
)
...
...
lms/djangoapps/courseware/views.py
View file @
c33571ff
...
...
@@ -458,7 +458,10 @@ def jump_to_id(request, course_id, module_id):
course_location
=
CourseDescriptor
.
id_to_location
(
course_id
)
items
=
modulestore
()
.
get_items
([
'i4x'
,
course_location
.
org
,
course_location
.
course
,
None
,
module_id
])
items
=
modulestore
()
.
get_items
(
[
'i4x'
,
course_location
.
org
,
course_location
.
course
,
None
,
module_id
],
course_id
=
course_id
)
if
len
(
items
)
==
0
:
raise
Http404
(
"Could not find id = {0} in course_id = {1}. Referer = {2}"
.
...
...
lms/djangoapps/instructor/hint_manager.py
View file @
c33571ff
...
...
@@ -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
...
...
lms/djangoapps/instructor/tests/test_hint_manager.py
View file @
c33571ff
...
...
@@ -42,7 +42,7 @@ class HintManagerTest(ModuleStoreTestCase):
value
=
5
)
# Mock out location_to_problem_name, which ordinarily accesses the modulestore.
# (I can't figure out how to get fake structures into the modulestore.)
view
.
location_to_problem_name
=
lambda
loc
:
"Test problem"
view
.
location_to_problem_name
=
lambda
course_id
,
loc
:
"Test problem"
def
test_student_block
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment