Merge pull request #6797 from edx/mobile/perf_improvements

Mobile performance improvements
This commit is contained in:
Nimisha Asthagiri
2015-02-10 16:21:37 -05:00
8 changed files with 155 additions and 190 deletions

View File

@@ -304,14 +304,7 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
self._field_data.set_many(self, field_data)
del self.data
editable_fields = super(VideoDescriptor, self).editable_metadata_fields
self.source_visible = False
# Set download_video field to default value if its not explicitly set for backward compatibility.
download_video = editable_fields['download_video']
if not download_video['explicitly_set']:
self.download_video = self.download_video
if self.source:
# If `source` field value exist in the `html5_sources` field values,
# then delete `source` field value and use value from `html5_sources` field.
@@ -320,14 +313,17 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
self.download_video = True
else: # Otherwise, `source` field value will be used.
self.source_visible = True
if not download_video['explicitly_set']:
if not self.fields['download_video'].is_set_on(self):
self.download_video = True
# Set download_video field to default value if its not explicitly set for backward compatibility.
if not self.fields['download_video'].is_set_on(self):
self.download_video = self.download_video
# for backward compatibility.
# If course was existed and was not re-imported by the moment of adding `download_track` field,
# we should enable `download_track` if following is true:
download_track = editable_fields['download_track']
if not download_track['explicitly_set'] and self.track:
if not self.fields['download_track'].is_set_on(self) and self.track:
self.download_track = True
def editor_saved(self, user, old_metadata, old_content):

View File

@@ -403,7 +403,7 @@ class XModuleMixin(XBlockMixin):
else:
return [self.display_name_with_default]
def get_children(self):
def get_children(self, usage_key_filter=lambda location: True):
"""Returns a list of XBlock instances for the children of
this module"""
@@ -413,6 +413,9 @@ class XModuleMixin(XBlockMixin):
if getattr(self, '_child_instances', None) is None:
self._child_instances = [] # pylint: disable=attribute-defined-outside-init
for child_loc in self.children:
# Skip if it doesn't satisfy the filter function
if not usage_key_filter(child_loc):
continue
try:
child = self.runtime.get_block(child_loc)
if child is None: