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
8ca4c685
Commit
8ca4c685
authored
Jul 30, 2014
by
Daniel Friedman
Committed by
cahrens
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce parent/child lookups in create_xblock_info
STUD-1997
parent
529672ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
cms/djangoapps/contentstore/views/item.py
+11
-6
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
8ca4c685
...
...
@@ -588,7 +588,7 @@ def _get_module_info(xblock, rewrite_static_links=True):
def
create_xblock_info
(
xblock
,
data
=
None
,
metadata
=
None
,
include_ancestor_info
=
False
,
include_child_info
=
False
,
course_outline
=
False
,
include_children_predicate
=
NEVER
):
course_outline
=
False
,
include_children_predicate
=
NEVER
,
parent_xblock
=
None
):
"""
Creates the information needed for client-side XBlockInfo.
...
...
@@ -622,8 +622,15 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
return
None
if
parent_xblock
:
is_xblock_unit
=
parent_xblock
.
category
==
'sequential'
and
xblock
.
category
==
'vertical'
else
:
is_xblock_unit
=
is_unit
(
xblock
)
is_unit_with_changes
=
is_xblock_unit
and
modulestore
()
.
has_changes
(
xblock
.
location
)
# Compute the child info first so it can be included in aggregate information for the parent
if
include_child_info
and
xblock
.
has_children
:
should_visit_children
=
include_child_info
and
(
course_outline
and
not
is_xblock_unit
or
not
course_outline
)
if
should_visit_children
and
xblock
.
has_children
:
child_info
=
_create_xblock_child_info
(
xblock
,
course_outline
,
...
...
@@ -636,9 +643,6 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
release_date
=
get_default_time_display
(
xblock
.
start
)
if
xblock
.
start
!=
DEFAULT_START_DATE
else
None
published
=
modulestore
()
.
has_item
(
xblock
.
location
,
revision
=
ModuleStoreEnum
.
RevisionOption
.
published_only
)
is_xblock_unit
=
is_unit
(
xblock
)
is_unit_with_changes
=
is_xblock_unit
and
modulestore
()
.
has_changes
(
xblock
.
location
)
xblock_info
=
{
"id"
:
unicode
(
xblock
.
location
),
"display_name"
:
xblock
.
display_name_with_default
,
...
...
@@ -784,7 +788,8 @@ def _create_xblock_child_info(xblock, course_outline, include_children_predicate
child_info
[
'children'
]
=
[
create_xblock_info
(
child
,
include_child_info
=
True
,
course_outline
=
course_outline
,
include_children_predicate
=
include_children_predicate
include_children_predicate
=
include_children_predicate
,
parent_xblock
=
xblock
)
for
child
in
xblock
.
get_children
()
]
return
child_info
...
...
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