Commit 75d61b6f by E. Kolpakov

Renamed course_key to structure_key to reflect the fact it might be a library key as well.

parent 9bbad954
......@@ -249,7 +249,7 @@ class BulkOperationsMixin(object):
if bulk_ops_record.is_root:
self._start_outermost_bulk_operation(bulk_ops_record, course_key)
def _end_outermost_bulk_operation(self, bulk_ops_record, course_key, emit_signals=True):
def _end_outermost_bulk_operation(self, bulk_ops_record, structure_key, emit_signals=True):
"""
The outermost nested bulk_operation call: do the actual end of the bulk operation.
......@@ -257,12 +257,12 @@ class BulkOperationsMixin(object):
"""
pass
def _end_bulk_operation(self, course_key, emit_signals=True):
def _end_bulk_operation(self, structure_key, emit_signals=True):
"""
End the active bulk operation on course_key.
End the active bulk operation on structure_key (course or library key).
"""
# If no bulk op is active, return
bulk_ops_record = self._get_bulk_ops_record(course_key)
bulk_ops_record = self._get_bulk_ops_record(structure_key)
if not bulk_ops_record.active:
return
......@@ -273,9 +273,9 @@ class BulkOperationsMixin(object):
if bulk_ops_record.active:
return
self._end_outermost_bulk_operation(bulk_ops_record, course_key, emit_signals)
self._end_outermost_bulk_operation(bulk_ops_record, structure_key, emit_signals)
self._clear_bulk_ops_record(course_key)
self._clear_bulk_ops_record(structure_key)
def _is_in_bulk_operation(self, course_key, ignore_case=False):
"""
......
......@@ -466,17 +466,17 @@ class MongoBulkOpsMixin(BulkOperationsMixin):
# ensure it starts clean
bulk_ops_record.dirty = False
def _end_outermost_bulk_operation(self, bulk_ops_record, course_id, emit_signals=True):
def _end_outermost_bulk_operation(self, bulk_ops_record, structure_key, emit_signals=True):
"""
Restart updating the meta-data inheritance cache for the given course.
Restart updating the meta-data inheritance cache for the given course or library.
Refresh the meta-data inheritance cache now since it was temporarily disabled.
"""
if bulk_ops_record.dirty:
self.refresh_cached_metadata_inheritance_tree(course_id)
self.refresh_cached_metadata_inheritance_tree(structure_key)
if emit_signals:
self.send_bulk_published_signal(bulk_ops_record, course_id)
self.send_bulk_library_updated_signal(bulk_ops_record, course_id)
self.send_bulk_published_signal(bulk_ops_record, structure_key)
self.send_bulk_library_updated_signal(bulk_ops_record, structure_key)
bulk_ops_record.dirty = False # brand spanking clean now
......
......@@ -229,9 +229,9 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
# Ensure that any edits to the index don't pollute the initial_index
bulk_write_record.index = copy.deepcopy(bulk_write_record.initial_index)
def _end_outermost_bulk_operation(self, bulk_write_record, course_key, emit_signals=True):
def _end_outermost_bulk_operation(self, bulk_write_record, structure_key, emit_signals=True):
"""
End the active bulk write operation on course_key.
End the active bulk write operation on structure_key (course or library key).
"""
dirty = False
......@@ -268,8 +268,8 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
self.db_connection.update_course_index(bulk_write_record.index, from_index=bulk_write_record.initial_index)
if dirty and emit_signals:
self.send_bulk_published_signal(bulk_write_record, course_key)
self.send_bulk_library_updated_signal(bulk_write_record, course_key)
self.send_bulk_published_signal(bulk_write_record, structure_key)
self.send_bulk_library_updated_signal(bulk_write_record, structure_key)
def get_course_index(self, course_key, ignore_case=False):
"""
......
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