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
4be5aeb1
Commit
4be5aeb1
authored
Feb 19, 2016
by
Usman Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11550 from edx/muzaffar/tnl4013
Using display_name_with_default instead of display_name.
parents
4dbcf9a1
50952241
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
openedx/core/djangoapps/bookmarks/models.py
+1
-2
openedx/core/djangoapps/bookmarks/tasks.py
+1
-1
openedx/core/djangoapps/bookmarks/tests/test_tasks.py
+33
-1
No files found.
openedx/core/djangoapps/bookmarks/models.py
View file @
4be5aeb1
...
...
@@ -177,9 +177,8 @@ class Bookmark(TimeStampedModel):
block
=
modulestore
()
.
get_item
(
ancestor_usage_key
)
except
ItemNotFoundError
:
return
[]
# No valid path can be found.
path_data
.
append
(
PathItem
(
usage_key
=
block
.
location
,
display_name
=
block
.
display_name
)
PathItem
(
usage_key
=
block
.
location
,
display_name
=
block
.
display_name
_with_default
)
)
return
path_data
...
...
openedx/core/djangoapps/bookmarks/tasks.py
View file @
4be5aeb1
...
...
@@ -32,7 +32,7 @@ def _calculate_course_xblocks_data(course_key):
usage_id
=
unicode
(
current_block
.
scope_ids
.
usage_id
)
block_info
=
{
'usage_key'
:
current_block
.
scope_ids
.
usage_id
,
'display_name'
:
current_block
.
display_name
,
'display_name'
:
current_block
.
display_name
_with_default
,
'children_ids'
:
[
unicode
(
child
.
scope_ids
.
usage_id
)
for
child
in
children
]
}
blocks_info_dict
[
usage_id
]
=
block_info
...
...
openedx/core/djangoapps/bookmarks/tests/test_tasks.py
View file @
4be5aeb1
...
...
@@ -4,7 +4,7 @@ Tests for tasks.
import
ddt
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
check_mongo_calls
from
xmodule.modulestore.tests.factories
import
check_mongo_calls
,
ItemFactory
from
..models
import
XBlockCache
from
..tasks
import
_calculate_course_xblocks_data
,
_update_xblocks_cache
...
...
@@ -164,3 +164,35 @@ class XBlockCacheTaskTests(BookmarksTestsBase):
with
self
.
assertNumQueries
(
3
):
_update_xblocks_cache
(
course
.
id
)
def
test_update_xblocks_cache_with_display_name_none
(
self
):
"""
Test that the xblocks data is persisted correctly with display_name=None.
"""
block_with_display_name_none
=
ItemFactory
.
create
(
parent_location
=
self
.
sequential_2
.
location
,
category
=
'vertical'
,
display_name
=
None
)
_update_xblocks_cache
(
self
.
course
.
id
)
self
.
course_expected_cache_data
.
update
(
{
block_with_display_name_none
.
location
:
[
[
self
.
course
.
location
,
self
.
chapter_1
.
location
,
self
.
sequential_2
.
location
,
]
]
}
)
for
usage_key
,
__
in
self
.
course_expected_cache_data
.
items
():
xblock_cache
=
XBlockCache
.
objects
.
get
(
usage_key
=
usage_key
)
for
path_index
,
path
in
enumerate
(
xblock_cache
.
paths
):
for
path_item_index
,
path_item
in
enumerate
(
path
):
self
.
assertEqual
(
path_item
.
usage_key
,
self
.
course_expected_cache_data
[
usage_key
][
path_index
][
path_item_index
+
1
]
)
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