Commit bd05dc0b by John Eskew

Wrap course structure generation task in bulk operation.

parent 843c073f
...@@ -13,6 +13,7 @@ def _generate_course_structure(course_key): ...@@ -13,6 +13,7 @@ def _generate_course_structure(course_key):
""" """
Generates a course structure dictionary for the specified course. Generates a course structure dictionary for the specified course.
""" """
with modulestore().bulk_operations(course_key):
course = modulestore().get_course(course_key, depth=None) course = modulestore().get_course(course_key, depth=None)
blocks_stack = [course] blocks_stack = [course]
blocks_dict = {} blocks_dict = {}
...@@ -27,7 +28,8 @@ def _generate_course_structure(course_key): ...@@ -27,7 +28,8 @@ def _generate_course_structure(course_key):
"children": [unicode(child.scope_ids.usage_id) for child in children] "children": [unicode(child.scope_ids.usage_id) for child in children]
} }
# Retrieve these attributes separately so that we can fail gracefully if the block doesn't have the attribute. # Retrieve these attributes separately so that we can fail gracefully
# if the block doesn't have the attribute.
attrs = (('graded', False), ('format', None)) attrs = (('graded', False), ('format', None))
for attr, default in attrs: for attr, default in attrs:
if hasattr(curr_block, attr): if hasattr(curr_block, attr):
......
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